当前位置:网站首页>实验一作业
实验一作业
2020-11-08 20:13:00 【数媒201郭凯妮】
第一题
#include<stdio.h>
#include<stdlib.h>
int main()
{
printf("**********¥¥\n");
printf("¥¥¥\n");
printf("This is my first C program:(\n");
printf("**********¥¥¥¥¥\n");
system("pause");
return 0;
}
第二题
#include<stdio.h>
#define p 3.14
int main()
{
double a,b,v;
printf("输入圆柱的半径\n");
scanf("%lf",&a);
printf("输入圆柱的高\n");
scanf("%lf",&b);
v = (p*a*a/2)*b;
printf("圆柱体积=%.2lf",v);
return 0;
}
第三题
#include<stdio.h>
int main()
{
float a, b, c, d;
printf("输入第一个数:\n");
scanf("%f", &a);
printf("输入第二个数:\n");
scanf("%f", &b);
printf("输入第三个数:\n");
scanf("%f", &c);
d = (a + b + c) / 3.0;
printf("平均数=%.2f", d);
return 0;
}
第四题
#include<stido.h>
int main()
{
int a, b, c, d;
printf("输入秒数:\n");
scanf_s("%d", &a);
b = a / 3600; //小时
c = (a % 3600) / 60; //分钟
d = a % 60;//秒
printf("%d秒=为%d小时%d分钟%d秒",a, b, c, d);
return 0;
}
第五题
#include<stdio.h>
#define PI 3.1415926
void main()
{
float a, v;
printf("输入半径\n");
scanf("%f", &a);
v = 4 / 3 * PI * a * a * a;
printf("体积为=%.2f", v);
return 0;
}
第六题
#include<stdio.h>
#include<stdlib.h>
void main()
{
printf(" *\n");
printf(" *\n");
printf(" *\n");
printf(" * *\n");
printf(" *\n");
system("pause");
return 0; 注意(显示出错误但可运行)
}
第七题
#include<stdio.h>
int main()
{
float a, b;
printf("输入你的金额:");
scanf("%f", &a);
b = a * 1.05;
printf("\n最后金额=%f", b);
return 0;
}
第八题
#include<stdio.h>
int main()
{
int n, m;
printf("输入一个值x=");
scanf("%d", &n);
m = (3 * n + 2) * (n - 5) * (n - 1) * (n + 7) * n - 6;
printf("(((((3x+2)x-5)x-1)x+7)x-6)=%d", m);
return 0;
}
第九题
#include<stdio.h>
int main()
{
int q, w, e, r, f;
printf("输入金额=");
scanf("%d", &q);
w = q / 20;
e = q % 20 / 10;
r = q % 20 % 10 / 5;
f = q % 5;
printf("\n20$要%d张", w);
printf("\n10$要%d",e);
printf("\n5$要%d",r);
printf("\n1$要%d",f);
return 0;
}
第十题
#include<stdio.h>
int main()
{
float b,lilv,q1,q2,q3,h;
printf("输入你原来的欠款:\n");
scanf("%f", &b);
printf("输入利率= \n");
scanf("%f", &lilv);
printf("输入每月还款= \n");
scanf("%f",&h);
q1 = (b-h) * lilv*0.01 / 12;
q2 = (b -h-h+q1) *lilv*0.01 / 12;
q3 = (b -h-h-h+ q1 + q2) * lilv*0.01 / 12;
printf("第一次付完钱后=%.2f\n", b-h+q1 );
printf("第二次付完钱后=%.2f\n", b-h-h+q1 + q2);
printf("第三次还完款后=%.2f\n", b-h-h-h+q1 + q2 + q3);
return 0;
}
版权声明
本文为[数媒201郭凯妮]所创,转载请带上原文链接,感谢
https://my.oschina.net/u/4785177/blog/4708329
边栏推荐
猜你喜欢
随机推荐
getBytes之 LengthFieldBasedFrameDecoder服务端解析
MongoDB数据库
Tencent: Although Ali's Taichung is good, it is not omnipotent!
Solve the failure of go get download package
Dynamic relu: Microsoft's refreshing device may be the best relu improvement | ECCV 2020
Wechat applet related
Liteos message queuing
IT industry salary has been far ahead! Ten years later, is the programmer still a high paying profession?
Js中常见的内存泄漏场景
使用基于GAN的过采样技术提高非平衡COVID-19死亡率预测的模型准确性
C / C + + learning diary: original code, inverse code and complement code
存储过程动态查询处理方法
Package subsystem in Simulink
Summary: in October, more investment management strategies have come to the new overseas defi project!
Dynamic programming: maximum subarray
Swagger介绍和应用
[random talk] JS related thread model sorting
PAT_ Grade A_ 1056 Mice and Rice
Interesting article sharing: what is the difference between C language and C + +, C?
net.sf.json . jsonobject's format processing of time stamp