main(){ printf("this is a c program .\n "); getch();}
main()
{
printf("***************\n");
printf("very good!\n");
printf("***************");
getch();
}
printf("this is what?");/*直接输出双引号内的字符串。*/
printf("this is what ?\n");
/*\N转意字符 不原样输出该字符串,而是起到换行作用*/
/*\p 退格*/
printf("this is %d",a);
/*%d 用来代替“”后面的变量并指定该变量以什么数据类型输出
%d 以整型输出
%f 以实型输出
%c 以字符型输出*/
scanf("%d&d",&a,&b);
/*让用户输出两个整数,放在变量a,b中*/
main()
{
int a,b,c;
scanf("%d %d",&a,&b);
c = a+b;
printf("%d",c);
getch();
}
main()
{
int r;
float s,c;
printf("Please input a radius\n");
scanf("%d",&r);
s = 3.14 * r * r;
c = 2 * 3.14 * r;
printf("The circumference of the circle is %f\n",c);
printf("The area of the circle is %f",s);
getch();
}
main()
{
int num1,num2,sum,product,difference,remainder;
printf("Please input three numbers:\n");
scanf("%d%d",&num1,&num2);
sum = num1 + num2 ;
product = num1 * num2 ;
difference = num1 - num2 ;
remainder = num1 % num2 ;
printf("The sum of two numbers is %d\n",sum);
printf("The product of two numbers is %d\n",product);
printf("The difference between two numbers is%d\n",difference);
printf("The remainder of two number is %d\n",remainder);
getch();
}
原文:http://www.cnblogs.com/tsinghuan/p/3810091.html