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("你不是成年人");
}
绛旓細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;}
绛旓細fgets(input, sizeof(input), stdin); // 浠庢爣鍑杈撳叆涓幏鍙栫敤鎴疯緭鍏 sscanf(input, "%d", &age); // 灏嗙敤鎴疯緭鍏ョ殑瀛楃涓茶浆鎹㈡垚鏁存暟 if (age <= 0 || age > 120) { // 鍒ゆ柇鏄惁鏄悎娉骞撮緞 printf("鎮ㄨ緭鍏ョ殑骞撮緞涓嶅悎娉曪紒\n");} else { printf("鎮ㄨ緭鍏ョ殑骞撮緞鏄 %d 宀侊紝鏄...
绛旓細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;} ...
绛旓細閿欒鍦版柟鏈変袱澶勶紝涓鏄▼搴忕殑澶存枃浠剁殑寮曠敤閿欒锛屽簲璇ヤ负<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,...
绛旓細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("绗簩涓鐢熺殑骞撮緞鏄...
绛旓細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=...
绛旓細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(...
绛旓細define THISYEAR 2007 main(){ int borthYear = 0;scanf("Input Your Borth Year: ", &borthYear);printf("Your age is: ", THISYEAR - borthYear);}
绛旓細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));} 閫掑綊瀹炵幇