谁给我做个加法程序啊

来源:百度知道 编辑:UC知道 时间:2024/05/17 18:10:20

C代码:
#include<stdio.h>
main()
{
float a, b, s;
printf("输入两个数:\n");//两数间用加号连接
scanf("%f+%f",&a,&b);
s=a+b;
printf("=");
printf("%f",s);

加法?就是输入两个数自动出答案的?那我给你做吧

#include<stdio.h>
void main()
{
int a, b, c;
printf("输入两个数");
scanf("%d %d",a,b);
c=a+b;
printf("%d+%d=%d", a, b, c);
}

太简单了吧...

main()
{
float a, b, c;
printf("输入两个数:");
scanf("%d %d",&a,&b);
c=a+b;
printf("%d+%d=%d", a, b, c);
}