当前位置:网站首页>实验一作业
实验一作业
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
边栏推荐
- Learn volatile, you change your mind, I see
- Looking for better dynamic getter and setter solutions
- Mongodb add delete modify query operation
- Function classification big PK! How to use sigmoid and softmax respectively?
- Opencv solves the problem of ippicv download failure_ 2019_ lnx_ intel64_ general_ 20180723.tgz offline Download
- 后缀表达式转中缀表达式
- Array acquaintance
- I used Python to find out all the people who deleted my wechat and deleted them automatically
- AI香水来了,你会买吗?
- 我用 Python 找出了删除我微信的所有人并将他们自动化删除了
猜你喜欢
[elastic search technology sharing] - ten pictures to show you the principle of ES! Understand why to say: ES is quasi real time!
Looking for better dynamic getter and setter solutions
数组初相识
Wechat applet related
C / C + + learning diary: original code, inverse code and complement code
Is parameter passing in go language transfer value or reference?
Five design schemes of singleton mode
C/C++知识分享: 函数指针与指针函数,看完这篇你还能不懂?
Dynamic query processing method of stored procedure
Django之简易用户系统(3)
随机推荐
Use markdown
后缀表达式转中缀表达式
Awk implements SQL like join operation
Development and deployment of image classifier application with fastai
[elastic search technology sharing] - ten pictures to show you the principle of ES! Understand why to say: ES is quasi real time!
(O) Analysis of service manager (1) BinderInternal.getContextObject
getBytes之 LengthFieldBasedFrameDecoder服务端解析
SQL 速查
单例模式的五种设计方案
VirtualBox install centos7
数组初相识
iptables从入门到掌握
Regular backup of WordPress website program and database to qiniu cloud
RSA非对称加密算法
学会了volatile,你变心了,我看到了
存储过程动态查询处理方法
Case analysis of entitycore framework
Summary: in October, more investment management strategies have come to the new overseas defi project!
第一部分——第1章概述
Looking for better dynamic getter and setter solutions