【C语言学习】scanf输入a,b计算结果

第一版


#include<stdio.h>
int main(){
int a,b;
scanf("%d %d",&a,&b);
printf("%d \n",a+b);
return 0;


第二版

#include<stdio.h>
int main(){
float a,b;
scanf("%f %f",&a,&b);
printf("%f \n",a+b);
return 0;


C语言对数据的类型要求很严格。

猜你喜欢

转载自blog.csdn.net/HLJJMS8/article/details/52609247
今日推荐