#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;
}
#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;
}
#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");