Perform Simple Athematic Operation Program
Where a is 5 and b is 2.
+(Add) -(Subtraction) *(Multiplication
/ (Division) %(Remainder)
#include<stdio.h>
main()
{
int a=5,b=2,c,d,e,f,g;
c=d=e=f=g=0;
c=a+b;
d=a-b;
e=a*b;
f=a/b;
g=a%b;
printf("\nC=%d\nD=%d\nE=%d",c,d,e);
printf("\nF=%d\nG=%d",f,g);
}
Output
Note : if Both are Integer then result is
integer other wise Float.
Ex. (5/2.0 or 5.0/2 or 5.0/2.0 ----- 2.5)
No comments:
Post a Comment