c语言输入年龄,输出是否成年? c语言输出年龄最大的人

\u600e\u4e48\u5728c\u8bed\u8a00\u4e2d\u8f93\u5165\u5e74\u9f84\u7136\u540e\u5f97\u5230\u67d0\u67d0\u591a\u5c11\u5c81

#include
int main()
\uff5bint year\uff1b
scanf(\u201c%d\u201d,&year);
printf(\u201c\u67d0\u67d0\u4e3a\uff05d\u5c81\u201d,year);
fflush(stain);
getchar();
\uff5d\u7eaf\u624b\u673a\u8f93\u5165\u7684\u8981\u662f\u6807\u70b9\u7b26\u53f7\u6709\u95ee\u9898 \u8bf7\u6539\u6210\u82f1\u6587\u8f93\u5165\u6a21\u5f0f\u4e0b\u7684\u6807\u70b9\u7b26\u53f7

#include #include main(){ int max,n=0,num; while(1) { num=rand()%100;//\u4ea7\u751f\u4e00\u4e2a0~99\u7684\u968f\u673a\u6570 if(num<10) continue; //\u82e5\u968f\u673a\u6570\u7684\u503c\u5c0f\u4e8e10\u5219\u63d0\u524d\u7ed3\u675f\u672c\u6b21\u5faa\u73af\u91cd\u65b0\u751f\u6210\u968f\u673a\u6570 printf("%5d",num);//\u5426\u5219\u5c31\u8f93\u51fa\u968f\u673a\u6570 max=num; //\u5c06\u968f\u673a\u6570\u8d4b\u7ed9max n++;//\u5c06\u968f\u673a\u6570\u7684\u8ba1\u6570\u5668\u52a01\uff0c\u5373n=1 break;//\u9000\u51fa\u5faa\u73af }//\u5f97\u5230\u4e00\u4e2a10~100\u4ee5\u5185\u7684\u968f\u673a\u6570 while(n<=20)//\u82e5\u8ba1\u6570\u5668\u7684\u503c\u5c0f\u4e8e20\uff0c\u8868\u793a\u968f\u673a\u6570\u4e0d\u591f { num=rand()%100;//\u4ea7\u751f\u4e00\u4e2a0~99\u7684\u968f\u673a\u6570 if(num<10)//\u82e5\u968f\u673a\u6570\u7684\u503c\u5c0f\u4e8e10\u5219\u63d0\u524d\u7ed3\u675f\u672c\u6b21\u5faa\u73af\u91cd\u65b0\u751f\u6210\u968f\u673a\u6570 continue; if(max

#include<stdio.h>
int main()
{
int age;
printf("输入你的年龄:");
scanf("%d",&age);
if(age>=18)
{printf("你是成年人。");}
else
{printf("你是未成年人。");}
return 0;
}


#include<stdio.h>
void main()
{
int age;
printf("please input you age:\n");
scanf("%d",&age);
if(age>18)
printf("你已经成年了!\n");
else
printf("你还得多吃两年饭哦。\n");
}

#include<stdio.h>
void main()
{
int age;
printf("请输入年龄:\n");
scanf("%d",&age);
if(age>18)
printf("成年\n");
else
printf("未成年\n");
}

#include<stdio.h>
void main()
{
int age;
scanf("%d",&age);
if(age>18)
printf("成年\n");
else
printf("未成年\n");
}

#include<stdio.h>
main()
{
int age;
printf("输入你的年龄:");
scanf("%d",&age);
if(age>=18)
printf("你是成年人");else printf("你不是成年人");
}

  • C璇█缁冧範switch璇彞,姹傚ぇ绁
    绛旓細include <stdio.h>int main(int argc, char *argv[]){int age;printf("input age:");scanf("%d",&age);switch(age) {case 2: case 3:printf("age:%d,enter Lower class\n",age);break;case 4:printf("age:%d,enter Middle class\n",age);break;case 5: case 6:printf("age:%d...
  • 瀹氫箟涓涓彉閲,瀛樻斁鑷繁鐨骞撮緞,骞杈撳嚭鑷繁鐨勫勾榫勩(鎴戠煡閬撹繖閬撻寰堢畝鍗...
    绛旓細杩欓鏄緢绠鍗 include <stdio.h>int main(){ int age = 100; printf("%d\n", age); return 0;}
  • 鐢c璇█鍐欎竴涓汉鐨骞撮緞鏄惁鏄涓涓悎娉杈撳叆?
    绛旓細fgets(input, sizeof(input), stdin); // 浠庢爣鍑杈撳叆涓幏鍙栫敤鎴疯緭鍏 sscanf(input, "%d", &age); // 灏嗙敤鎴疯緭鍏ョ殑瀛楃涓茶浆鎹㈡垚鏁存暟 if (age <= 0 || age > 120) { // 鍒ゆ柇鏄惁鏄悎娉骞撮緞 printf("鎮ㄨ緭鍏ョ殑骞撮緞涓嶅悎娉曪紒\n");} else { printf("鎮ㄨ緭鍏ョ殑骞撮緞鏄 %d 宀侊紝鏄...
  • 濡備綍鐢C璇█缂栧啓涓涓▼搴,杈撳叆浣犵殑濮撳悕鍜骞撮緞骞杈撳嚭?
    绛旓細include <stdio.h> int main(void){ char name[20];int age;printf("璇杈撳叆浣犵殑濮撳悕锛");scanf("%s",name);printf("璇疯緭鍏ヤ綘鐨勫勾榫勶細");scanf("%d",&age);printf("浣犵殑濮撳悕鏄細%s\n",name);printf("浣犵殑骞撮緞鏄锛%d\n",age);return 0;} ...
  • 姹傜敤C璇█杈撳嚭骞撮緞鐨勭▼搴忎唬鐮
    绛旓細閿欒鍦版柟鏈変袱澶勶紝涓鏄▼搴忕殑澶存枃浠剁殑寮曠敤閿欒锛屽簲璇ヤ负<stdio.h>;浜屽氨鏄痝=a-d锛屽簲璇ユ敼鎴恎=d-a锛涘氨鍙互浜嗭紝浠ヤ笅鏄慨鏀瑰悗鐨勭▼搴忥細include<stdio.h> void main(){ int a,b,c,d,e,f,g; /*a,b,c涓哄嚭鐢熷勾鏈堟棩,d,e,f涓哄綋鍓嶅勾鏈堟棩*,g涓骞撮緞*/ printf("Enter:");scanf("%d,%d,%d,...
  • 1銆佺紪鍐C璇█绋嬪簭,鎸夋彁绀杈撳叆涓ゅ悕瀛︾敓鐨骞撮緞骞杈撳嚭鏄剧ず鍦ㄥ睆骞曚笂銆俖鐧...
    绛旓細include <stdio.h> #include <stdlib.h> int main() { int age1,age2; printf("璇杈撳叆绗竴涓鐢熺殑骞撮緞锛歕n"); scanf("%d", &age1); printf("璇疯緭鍏ョ浜屼釜瀛︾敓鐨勫勾榫勶細\n"); scanf("%d", &age2); printf("绗竴涓鐢熺殑骞撮緞鏄锛%d\n", age1); printf("绗簩涓鐢熺殑骞撮緞鏄...
  • c璇█杈撳叆浣犵殑骞撮緞鍜宮涓湅鍙嬬殑骞撮緞,鍒ゆ柇璋佺殑骞撮緞灏忓苟缁欏嚭鐩稿簲鎻愮ず_鐧惧害...
    绛旓細include <stdio.h>int main(){int a[50],m,i,j,t;printf("璇杈撳叆鏈嬪弸鐨勪釜鏁帮細");scanf("%d",&m);printf("璇疯緭鍏ヤ綘鐨骞撮緞锛");scanf("%d",&a[0]);t=a[0];printf("璇疯緭鍏ヤ綘鐨勬湅鍙嬩滑鐨勫勾榫勶細");for(i=1;i<=m;i++)scanf("%d",&a[i]);for(i=0;i<=m;i++)for(j=...
  • C璇█鐨勯棶棰
    绛旓細include "stdio.h"int main(void){ int age =0;printf("璇杈撳叆鐨骞撮緞锛");scanf("%d",&age);while(age<=0 ) { printf("浣犺緭鍏ョ殑骞撮緞涓嶆纭紝璇烽噸鏂拌緭鍏n");printf("璇疯緭鍏ョ殑骞撮緞锛");scanf("%d",&age);} if(age>=70 || age <= 10) printf("姝や汉鍏嶇エ锛");else printf(...
  • 濡備綍鐢c璇█缂栧啓涓涓绠骞撮緞鐨勭▼搴?
    绛旓細define THISYEAR 2007 main(){ int borthYear = 0;scanf("Input Your Borth Year: ", &borthYear);printf("Your age is: ", THISYEAR - borthYear);}
  • 鐢C璇█鍑芥暟瑙e喅骞撮緞闂
    绛旓細include"stdio.h"int f(int n){ int t;if(n==4)t=15;else t=f(n+1)+2;return t;} main(){ int n;printf("绗竴涓殑骞撮緞涓猴細%d",f(1));} 閫掑綊瀹炵幇
  • 扩展阅读:c十十编程要学多久 ... c语言将12345倒序输出 ... c++和python先学哪个 ... c语言按从小到大输出 ... c语言输出格式大全 ... c++输入输出格式 ... c语言必背100代码 ... c语言输出姓名年龄 ... c语言输入年龄 判断年龄段 ...

    本站交流只代表网友个人观点,与本站立场无关
    欢迎反馈与建议,请联系电邮
    2024© 车视网