#include <stdio.h>
int main()
{
int a,b,res;
// Accept the two numbers from user
printf("\nEnter any first number: ");
scanf("%d", &a);
printf("\nEnter any second number: ");
scanf("%d", &b);
// Calculate rmainder of these two numbers
res = a%b;
// Show the result
printf("\n The Rmainder is: %d",res);
return 0;
}
Output:
Enter any first number:13
Enter any second number:2
The Remainder is : 1
Explanation:
In this program given above , we first declare three variables: a, b, and res. We then shown the message to user to input two numbers one by one , the numbers entered by user are stored in variable 'a' and `b`. The rmainder of these two numbers is calculated using the '%' operator and stored in the `res` variable. Finally the result is displayed to the user.
1.Write a program to add two numbers using the '+' operator.
2.Write a program in C to subtract two numbers using the '-' operator.
3.Write a program in C to multiply two numbers using the '*' operator.
4.Write a program to divide two numbers using the '/' operator.
6.Implement a program in C to perform bitwise AND on two numbers using the '&' operator.
7.Write a program in C to perform bitwise OR on two numbers using the '|' operator.
8.Write a program to perform bitwise XOR on two numbers using the '^' operator.
9.Write a program in C to perform bitwise left shift on a number using the '<<' operator.
10.Implement a program in C to perform bitwise right shift on a number using the '>>' operator.
11.Write a program to in C check if a number is even or odd using the bitwise AND operator.
12.Write a program in C to swap two numbers without using a temporary variable.
13.Write a program in C to find the minimum of two numbers without using the 'if' statement.
14. Write a program in C to check if a number is negative without using the 'if' statement.
15. Write a program in C to toggle a particular bit in a number using bitwise XOR.
Other Topic:-->>Basic Assignments. || conditional statements Assignments in C.