#include<stdio.h>
int main(){
int a,b,max;
printf("请输入两个整数:"); //格式化输出函数
scanf("%d%d
",&a,&b); //格式化输入函数
max=a;
if(max<b)
max=b;
printf("两个整数中最大的数为:%d
",max);
/*int a,b;
char c;
c=getchar(); //单个字符输入函数
c-=32;
putchar(c); //单个字符输出函数
scanf("%d*%2d",&a,&b);
//printf("hellow world
");
printf("a=%d,b=%d
",a,b);
//return 0;
int money;
scanf("请输入你要取的钱数%d
",&money); //分支结构
if(money % 100)
printf("你可以取钱");
else
putchar("请输入100的倍数");
*/
return 0;
}
#include<stdio.h>
int main(){
int age;
printf("请输入你的年龄:
");
scanf("%d
",&age);
switch(age){ //switch分支语句
case 1:
printf("你已经成年
");
break;
case 2:
printf("你没有成年
");
break;
default:
printf("null");
break;
}
}
#include<stdio.h>
int main(){
int i=1 ; //do while循环
int sum=0; int i=1;
do{
sum=sum+i; //while循环把循环的内容放在While程序体内
i++;
}
while(i<=100);
printf("1到100的和为:%d
",sum);
}
}
#include <stdio.h>
int main(){
/* int i,sum=0; //for循环语句
for(i=1;i<=100;i++){
sum+=i;
}
printf("1到100的和为:%d
",sum);
*/
int i,j=0;
for (i=1;i<=9;i++){
for(j=1;j<=i;j++){
printf("%d*%d=%d",i,j,i*j);
}
printf("
");
}
}