电脑桌面
添加小米粒文库到电脑桌面
安装后可以在桌面快捷访问

简单C语言程序得例子

简单C语言程序得例子_第1页
1/8
简单C语言程序得例子_第2页
2/8
简单C语言程序得例子_第3页
3/8
例子:#include main (){tips(); /*caller*/printf(“\n Success is about banging on after others have let go”);}tips() /*caller*/{printf (“\n When you reach the end of the rope tie a knot & hang on”,)0;}[上述程序得输出结果如下:When you reach the end of the ropt tie a knot & hang on、Success is about hanging on after others have let go、]#include main(){int a,fact;printf(“\nEnter any number”);scanf(“%d”,&a);fact=rec(a);printf(“Factorial value is%d”,fact);}rec(x);int x;{int f;if(x==1)return(1);elsef=x*rec(x-1);return(f);}[其显示得结果为: Factorial value is 2、]比较两个数较大得那个:#include main(){int a,b,max;scanf (“%d%d”,&a,&b);if (a>b)max=a;else max=b;printf (“%d”,max);}输出 a+b 得值:#include void main(){int a,b,x;scanf (“%d%d”,&a,&b);x=a+b;printf (“%d”,x);}输出 a,b 中最大得一位数:#include int max(int x,int y){int z;if (x>y) z=x;else z=y;return(z);}void main(){int a,b,c;scanf (“%d%d”,&a,&b);c=max(a,b);printf (“%d\n”,c);}输出 Hello:#include int main(){printf (“Hello!”);return 0;}求 1~100 得与:#include int main(){int s,n;s=0,n=1;A: s=s+n;n=n+1;if (n<=100)goto A;printf (“%d”,s);}请输入一个三位数,将其各位逆序输出:(如 153,输出 351)#include void main(){int x,y,a,b,c;printf ("请输入一个三位数得数:");scanf("%d",&x);a=x/100;b=x%100/10;c=x%10;y=c*100+b*10+a;printf ("\n%d",y);}#include void main(){int x,a,b,c,d;printf ("请输入一个三位数得数:");scanf("%d",&x);a=x/100;b=x%100/10;c=x%10;d=c*100+b*10+a;printf ("\n%d\n",d);}买鸡:#include void main(){int x,y,z;if(x>=0&&x<=19,y>=0&&y<=33,z>=0&&z<=100)while (x=19){x=0; 5*x+3*y+z/3==100&&x+y+z==100;x=x+1;}printf("%d%d%d",x,y,z);}y==(100-5*x-z/3)/3&&y==100-x-z;z==(100-5*x-3*y)*3&&z==100-x-y;#include void main(){int x=0,y,z;while (x<=19){5*x+3*y+z/3==100&&x+y+z==100;x=x+1;printf("%d%...

1、当您付费下载文档后,您只拥有了使用权限,并不意味着购买了版权,文档只能用于自身使用,不得用于其他商业用途(如 [转卖]进行直接盈利或[编辑后售卖]进行间接盈利)。
2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。
3、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。

碎片内容

简单C语言程序得例子

确认删除?
VIP
微信客服
  • 扫码咨询
会员Q群
  • 会员专属群点击这里加入QQ群
客服邮箱
回到顶部