c语言算正方形面积和周长,C语言编8个程序比如输入正方形边长求其面积和周长正方体求体积...

更新时间:2023-05-19 16:36:23 阅读: 评论:0

c语⾔算正⽅形⾯积和周长,C语⾔编8个程序⽐如输⼊正⽅形边长求其⾯积和周长正⽅体求体积...
匿名⽤户
1级
2018-08-07 回答
// 第⼀个:求数字位数
#include
#include
#include
#define CRT_SECURE_NO_DEPERCATE
int main(void)
{
int data;
printf("Enter a number:");
scanf("%d",&data);
if (data>=10000)
{printf("Input Error\n");system("pau");exit;}
el if (data>=1000)
printf("The number %4d has 4 numbers.\n");
el if (data>=100)
printf("The number %4d has 3 numbers.\n");
el if (data>=10)
printf("The number %4d has 2 numbers.\n");
el if (data>=1)
printf("The number %4d has 1 numbers.\n");
el    {printf("Input Error\n");system("pau");exit;}
system("pau");
return 0;
}
// 第⼆个24⼩时制->AM/PM
#include
#define CRT_SECURE_NO_DEPERCATE
int main(void)
{
int hour,minute;
printf("Enter a 24-hour time:");
scanf("%d:%d",&hour,&minute);
switch (hour)
{
ca 0:ca 1:ca 2:ca 3:ca 4:ca 5:ca 6:ca 7:ca 8:ca 9:ca 10:ca 11:ca 12: printf("Equivalent 12-hour time: %-2.2d:%-2.2d AM\n",hour,minute);break;
ca 13:ca 14:ca 15:ca 16:ca 17:ca 18:ca 19:ca 20:ca 21:ca 22:ca 23: printf("Equivalent 12-hour time: %-2.2d:%-2.2d PM\n",hour-12,minute);break;
ca 24:
printf("Equivalent 12-hour time: 00:%-2.2d AM\n",minute);break;
default:
printf("Input Error\n");system("pau");exit;
}
system("pau");
return 0;
}
// 第三个⽐较⽇期前后
#define CRT_SECURE_NO_DEPERCATE
#include
#include
#include
int main(void)
{
int year1,year2,month1,month2,day1,day2,p;
printf("Enter  first date (mm/dd/yy):");
scanf("%d/%d/%d",&month1,&day1,&year1);
printf("Enter cond date (mm/dd/yy):");
scanf("%d/%d/%d",&month2,&day2,&year2);
el if (day1<>day2)    p=day1>day2?1:2;
el                    p=0;
酸杨桃switch (p)
{
ca 1:printf("%2d/%-2.2d/%4d is earlier than %2d/%-2.2d/%4d\n",month2,day2,year2,month1,day1,
自制首饰盒year1);break; ca 2:printf("%2d/%-2.2d/%4d is earlier than %2d/%-2.2d/%4d\n",month1,day1,year1,month2,day2,year2);break; ca 0:printf("They are definetely equal.\n");break;
}
system("pau");
return 0;
}
// 第四个给分数评级
#define _CRT_SECURE_NO_DEPERCATE /*Before all the includes*/
#include
#include
#include
int main(void)
{
int grade;
_Bool checkpoint;
checkpoint=true;
//Input
while (checkpoint)
{
printf("Enter numerical grade:");
scanf("%d",&grade);
if (grade<0||grade>100) {printf("Input Error,plea try again\n");system("pau");}
el if checkpoint=fal;
}
//Output
printf("Letter grade: ");
switch (grade/10)
default:        printf("F");//Don't wanna
}
printf("\n");
//Pau
system("pau");
return 0;
}诉状书怎么写
// 第五个⽤英⽂显⽰数字
#define _CRT_SECURE_NO_DERECATE
#include
#include
#include
int main(void)
饮用水源地{
int input_number,first_digit,cond_digit;我的教育梦
bool checkpoint;
//input
checkpoint=true;
while (checkpoint)
{
printf("Enter a two-digit number: ");
scanf("%d",&input_number);
if (input_number<0||input_number>99) {printf("Input Error,plea try again.\n");system("pau");} el checkpoint=fal;
}
//output
抗日战争图片
printf("Your entered the number ");
if (input_number<=19)
switch (input_number) //0-19
ca  4:printf("four");    break;
ca  5:printf("five");    break;
着作ca  6:printf("six");      break;
ca  7:printf("ven");    break;
ca  8:printf("eight");    break;
ca  9:printf("nine");    break;
ca 10:printf("ten");      break;
ca 11:printf("eleven");  break;
ca 12:printf("twelve");  break;
ca 13:printf("thirteen"); break;
ca 14:printf("forteen");  break;
ca 15:printf("fifteen");  break;
ca 16:printf("sixteen");  break;
ca 17:printf("venteen");break;
ca 18:printf("eighteen"); break;
ca 19:printf("ninteen");  break;
}
台灯用英语怎么说el
{
first_digit=input_number/10;cond_digit=input_number%10; switch (first_digit)
{
ca 2:printf("twenty"); break;
ca 3:printf("thirty"); break;
ca 4:printf("forty");  break;
ca 5:printf("fifty");  break;
ca 6:printf("sixty");  break;
ca 7:printf("venty");break;
ca 8:printf("eighty"); break;

本文发布于:2023-05-19 16:36:23,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/82/696615.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:周长   数字   首饰盒   评级
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图