这个怎样用C程序编程

来源:百度知道 编辑:UC知道 时间:2024/05/18 14:02:46
要求a和b之间的差 积 余数要连在一起写 怎样写啊
#include <stdio.h>
int a,b,sum;
sum=a+b;
printf(sum is "%d"\n,sum)
这个是和 求高手写下 差 积 余数一起的程序

#include <stdio.h>
int a,b,sum;
sum=a+b;
cha=a-b;
ji=a*b;
yu=a%d;
printf(sum is "%d"\n,sum);
printf(cha is "%d"\n,cha);
printf(ji is "%d"\n,ji);
printf(yu is "%d"\n,yu);

>_<!!!!!
楼上的,你忘记定义变量了。恶寒

#include <stdio.h>

void main()
{
int a, b;
scanf("%d %d", &a, &b);
printf("a+b=%d\na-b=%d\na*b=%d\na%b=%d\n", a+b, a-b, a*b, a%b);
}

#include "stdio.h"

void main()
{
int a, b;
scanf("%d %d", &a, &b);
printf("a-b=%d a*b=%d a%b=%d",a-b, a*b, a%b);
}