if控制语句的例子
C语言中if控制语句的例子
第一个例子,三个数中求最大的:
#include <stdio.h>
main()
{
int a,b,c;
int max;
printf(“input 3 values of integer:”);
scanf(“%d%d%d”,&a,&b,&c);
if(a>b)
max=a;else
max=b;
if(max<c)
max=c;
printf(“the max of %d,%d,%d is %d n”,a,b,c,max);
}
第二个例子
#include <stdio.h>
main()
{
int i,m,n,x,y;
char s[80];
scanf(“%s”,s);
m=n=x=y=0;
i=0;
while(s[i]!=’
捐赠本站(Donate)
如您感觉文章有用,可扫码捐赠本站!(If the article useful, you can scan the QR code to donate))
- Author: shisekong
- Link: https://blog.361way.com/c_if/418.html
- License: This work is under a 知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议. Kindly fulfill the requirements of the aforementioned License when adapting or creating a derivative of this work.