当前位置:网站首页>实验一作业
实验一作业
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
边栏推荐
猜你喜欢
Function classification big PK! How to use sigmoid and softmax respectively?
快来看看!AQS 和 CountDownLatch 有怎么样的关系?
C/C++知识分享: 函数指针与指针函数,看完这篇你还能不懂?
Array acquaintance
WordPress网站程序和数据库定时备份到七牛云图文教程
SQL 速查
(O) Analysis of service manager (1) BinderInternal.getContextObject
单例模式的五种设计方案
Suffix expression to infix expression
Proficient in high concurrency and multithreading, but can't use ThreadLocal?
随机推荐
Django's simple user system (3)
[cloud service] there are so many ECS instances on alicloud server, how to select the type? Best practice note
Part 1 - Chapter 2 pointer operation
Introduction to latex
Flink系列(0)——准备篇(流处理基础)
Looking for better dynamic getter and setter solutions
寻找性能更优秀的动态 Getter 和 Setter 方案
The interface testing tool eolinker makes post request
后缀表达式转中缀表达式
给大家介绍下,这是我的流程图软件 —— draw.io
【Elasticsearch 技术分享】—— 十张图带大家看懂 ES 原理 !明白为什么说:ES 是准实时的!
PAT_甲级_1056 Mice and Rice
How much disk IO does a byte of read file actually take place?
Awk implements SQL like join operation
Dynamic ReLU:微软推出提点神器,可能是最好的ReLU改进 | ECCV 2020
How to deploy pytorch lightning model to production
Server side resolution of lengthfieldbasedframedecoder of GetBytes
使用Fastai开发和部署图像分类器应用
Solution to cross domain problem of front end separation
Liteos message queuing actual combat