#include<stdio.h>main(){int num;int x,y,z;scanf("%d",&num);
x = num %10;//个位数
y =(num %100- x)/10;//十位 或者(n/10)%10
z = num /100;//(n/100)%10printf("%d %d %d",x,y,z);return0;}
#include<stdio.h>main(){/*输入三个整数,之间用空格隔开。
第1个数作为首项,第2个数作为末项,第3个数作为公差。
通项公式为:an=a1+(n-1)*d
前n项和公式为:Sn=a1*n+[n*(n-1)*d]/2或Sn=[n*(a1+an)]/2。
*/int a1,an,d;int result;int t =0;scanf("%d %d %d",&a1,&an,&d);
t = a1;
result = an;while(t!=an){
result = result + t;
t = t + d;}printf("%d",result);}
1007
#include<stdio.h>#include<math.h>intmain(){//鸡兔同笼,数学方法int m,n,x,y;scanf("%d %d",&m,&n);
x =2*m - n/2;
y = n/2- m;printf("%d %d",x,y);return0;}
#include<stdio.h>intmain(){/*
某位学生的数学、英语和计算机课程的成绩,
求该生三门课程的平均分。
*/int math,english,computer;float average;scanf("%d %d %d",&math,&english,&computer);
average =(math+english+computer)/3.00;printf("%.2f",average);return0;}
1010
#include<stdio.h>#include<math.h>intmain(){/*
求圆的周长和面积
输入圆的半径,求圆的周长和面积。
要求定义圆周率为如下宏常量
#define PI 3.14159
*/#definePI3.14159float r;double s, c;scanf("%f",&r);
c =2* PI * r;
s = PI *pow(r ,2);printf("%.2lf %.2lf", c, s);return0;}
1011
#include<stdio.h>#include<math.h>intmain(){/*
输入圆柱体的底面半径r和高h,
计算圆柱体的表面积并输出到屏幕上。
要求定义圆周率为如下宏常量
#define PI 3.14159
*/#definePI3.14159float r, h;double s ;scanf("%f %f",&r,&h);
s =2* PI *pow(r,2)+2* PI * r * h;printf("%.2lf",s);return0;}
#include<stdio.h>intmain(){/*
给定一个不多于5位的正整数,判断它是几位数,并输出。
*/int num,n;scanf("%d",&num);if(num /10000!=0) n =5;elseif(num /1000!=0) n =4;elseif(num /100!=0) n =3;elseif(num /10!=0) n =2;else n =1;printf("%d", n);}
#include<stdio.h>intmain(){/*
输入三个整数x,y和z,求出其中最大的数。
*/int a,b,c;int max;;scanf("%d %d %d",&a,&b,&c);
max = a;if(max < b){
max = b;}if(max < c){
max = c;}printf("%d",max);return0;}
1022
#include<stdio.h>intmain(){/*
输入三个整数x,y和z,按从大到小的顺序输出它们的值。
*/int a,b,c;scanf("%d %d %d",&a,&b,&c);int d;if(a < b){
d = a;
a = b;
b = d;}if(c > a){
d = a;
a = c;
c = d;}if(c > b){
d = c;
c = b;
b = d;}printf("%d %d %d",a,b,c);return0;}
1023
#include<stdio.h>intmain(){/*
输入一个字符,若是小写字母,则变为大写输出,否则,原样输出。
*/char a;scanf("%c",&a);if(a>=97){//小写
a = a -32;}printf("%c",a);return0;}
1024
#include<stdio.h>intmain(){/*
输入一个英文字母(可能是大写,也可能是小写),
输出该字母在字母表中的序号(’a’和’A’的序号为1)。
A 65
a 97
*/int index;char s;scanf("%c",&s);if(s>=97){//小写
s = s -32;}printf("%d",s-64);}
1025
在这#include<stdio.h>intmain(){/*
给你三个ASCII字符(不含空白字符:包括空格、制表符\t、回车换行符\n),
找出其中最大的那个
*/char a,b,c;char max;scanf("%c %c %c",&a,&b,&c);if(a > b) max = a;else max = b;if(c > max) max = c;printf("%c",max);return0;} 里插入代码片
1026
#include<stdio.h>intmain(){/*
从键盘输入一个字符,判断该字符
是否大写字母、小写字母、数字字符或其他字符。
分别输出对应的提示信息。
*/char a;scanf("%c",&a);if('A'<= a && a<='Z'){printf("upper");}elseif('a'<= a && a<='z'){printf("lower");}elseif('0'<= a && a<='9'){printf("digit");}elseprintf("other");return0;}