c语言 圆周率~~ 大神们帮我看看哪里错了!

#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
#define PI 3.141592653

int main()
{

short int number2;
double C, A;

printf("Enter unsigned short int:");
scanf("%d", &number2);
C=2*PI*number2;
A=PI*number2*number2;
printf("A circle with radius %d has circumference of %.3f and an area of %.3f\n", number2, C, A);
scanf("%*c");

return 0;
}
不知道为什么会跳出来这个!

#include <stdio.h>
#define PI (3.141592653)
int main()
{
int number2;
double C,A;
printf("Enter int:");
scanf("%d",&number2);
C = 2*PI*number2;
A = PI*number2*number2;
printf("A circle with radius %d has circumference of %.3f and an area of %.3f\n",number2,C,A);
scanf("%*c");
return 0;
}

温馨提示:答案为网友推荐,仅供参考
第1个回答  2013-04-28
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
#define PI 3.141592653

int main()
{

short int number2;
double C, A;

printf("Enter unsigned short int:");
scanf("%d", &number2);
C=2*PI*number2;
A=PI*number2*number2;
printf("A circle with radius %d has circumference of %.3f and an area of %.3f\n", number2, C, A);
//这句去掉,scanf("%*c");

return 0;
}
第2个回答  2013-04-28
奇怪最后那句干嘛的scanf("%*c");

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网