Thursday, December 9, 2010

use of arithmetic operators and its precedense

//This program demonstrates the use of arithmetic operators and its precedense

#include

int main()
{
int value1, value2, value3;

clear();

value1 = 10;
value2 = 20;

value3 = value1 + value2 * 2;

printf("\nvalue1=%d, value2=%d, value1+value2*2=%d", value1, value2, value3);

value3 = (value1 + value2) * 2;

printf("\nvalue1=%d, value2=%d, (value1=value2)*2=%d", value1, value2, value3);

value1 = 20;
value2 = 10;

value3 = ((value1/value2)*value2)+(value1%value2);
printf("\nvalue1=%d, value2=%d, ((value1/value2)*value2)+(value1%value2)=%d", value1, value2, value3);
return 0;
}



Download RealPlayer for FREE

No comments:

Post a Comment