141个C语言经典小程序
源代码在线查看: sa1603.c
#include
void main()
{
int a,b,c; /*定义整型变量 */
a = 12;
b = 3;
printf("a=%d ,b=%d\n",a,b);
getch();
c = a + b; /* 加 */
printf("a+b=%d\n",c);
getch();
c = a - b; /* 减 */
printf("a-b=%d\n",c);
getch();
c = a * b; /* 乘 */
printf("a*b=%d\n",c);
getch();
c = a / b; /* 除 */
printf("a/b=%d\n",c);
getch();
c = a % b; /*求余 */
printf("a%%b=%d\n",c);
getch();
c = 12*a + b/2 - a*b*2/(a*c + b*2);
printf("12*a + b/2 - a*b*2/(a*c + b*2) = %d\n",c);
getch();
c = c/4+13*(a + b)/3 - a*b + 2*a*a;
printf("c/4+13*(a + b)/3 - a*b + 2*a*a = %d\n",c);
getch();
a = a + 1;
printf("a=%d\n",a);
getch();
b = b * 5;
printf("b=%d\n",b);
getch();
a = b = c = 20;
printf("a=%d,b=%d,c=%d\n",a,b,c);
getch();
a = b = c = 12*13/4;
printf("a=%d,b=%d,c=%d\n",a,b,c);
}