当前位置:网站首页>Experiment 1 assignment
Experiment 1 assignment
2020-11-08 20:13:00 【Guo kaini】
The first question is
#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;
}
The second question is
#include<stdio.h>
#define p 3.14
int main()
{
double a,b,v;
printf(" Enter the radius of the cylinder \n");
scanf("%lf",&a);
printf(" Enter the height of the cylinder \n");
scanf("%lf",&b);
v = (p*a*a/2)*b;
printf(" Cylinder volume =%.2lf",v);
return 0;
}
Third question
#include<stdio.h>
int main()
{
float a, b, c, d;
printf(" Enter the first number :\n");
scanf("%f", &a);
printf(" Enter the second number :\n");
scanf("%f", &b);
printf(" Enter the third number :\n");
scanf("%f", &c);
d = (a + b + c) / 3.0;
printf(" The average =%.2f", d);
return 0;
}
Fourth question
#include<stido.h>
int main()
{
int a, b, c, d;
printf(" Enter seconds :\n");
scanf_s("%d", &a);
b = a / 3600; // Hours
c = (a % 3600) / 60; // minute
d = a % 60;// second
printf("%d second = by %d Hours %d minute %d second ",a, b, c, d);
return 0;
}
Fifth question
#include<stdio.h>
#define PI 3.1415926
void main()
{
float a, v;
printf(" Enter the radius \n");
scanf("%f", &a);
v = 4 / 3 * PI * a * a * a;
printf(" The volume is =%.2f", v);
return 0;
}
Sixth question
#include<stdio.h>
#include<stdlib.h>
void main()
{
printf(" *\n");
printf(" *\n");
printf(" *\n");
printf(" * *\n");
printf(" *\n");
system("pause");
return 0; Be careful ( Show errors but run )
}
Question seven
#include<stdio.h>
int main()
{
float a, b;
printf(" Enter your amount :");
scanf("%f", &a);
b = a * 1.05;
printf("\n The final amount =%f", b);
return 0;
}
The eighth question
#include<stdio.h>
int main()
{
int n, m;
printf(" Enter a value 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;
}
Question 9
#include<stdio.h>
int main()
{
int q, w, e, r, f;
printf(" Input amount =");
scanf("%d", &q);
w = q / 20;
e = q % 20 / 10;
r = q % 20 % 10 / 5;
f = q % 5;
printf("\n20$ want %d Zhang ", w);
printf("\n10$ want %d",e);
printf("\n5$ want %d",r);
printf("\n1$ want %d",f);
return 0;
}
Question 10
#include<stdio.h>
int main()
{
float b,lilv,q1,q2,q3,h;
printf(" Enter your original debt :\n");
scanf("%f", &b);
printf(" Enter the interest rate = \n");
scanf("%f", &lilv);
printf(" Enter the monthly repayment = \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(" After the first payment =%.2f\n", b-h+q1 );
printf(" After the second payment =%.2f\n", b-h-h+q1 + q2);
printf(" After the third payment =%.2f\n", b-h-h-h+q1 + q2 + q3);
return 0;
}
版权声明
本文为[Guo kaini]所创,转载请带上原文链接,感谢
边栏推荐
- Countdownlatch explodes instantly! Based on AQS, why can cyclicbarrier be so popular?
- 为什么需要使用API管理平台
- (O) Analysis of service manager (1) BinderInternal.getContextObject
- 快来看看!AQS 和 CountDownLatch 有怎么样的关系?
- IT industry salary has been far ahead! Ten years later, is the programmer still a high paying profession?
- Opencv solves the problem of ippicv download failure_ 2019_ lnx_ intel64_ general_ 20180723.tgz offline Download
- Come and have a look! What is the relationship between AQS and countdownlatch?
- Flink系列(0)——准备篇(流处理基础)
- experiment
- Exercise 5
猜你喜欢

后缀表达式转中缀表达式

接口测试用例思路总结

Implementation of warehouse management system with ABP (net core) + easyUI + efcore

Django's simple user system (3)

Countdownlatch explodes instantly! Based on AQS, why can cyclicbarrier be so popular?

python开发qt程序读取图片的简单流程
![[elastic search technology sharing] - ten pictures to show you the principle of ES! Understand why to say: ES is quasi real time!](/img/dd/498ac0036c87037ea91debe72c1883.jpg)
[elastic search technology sharing] - ten pictures to show you the principle of ES! Understand why to say: ES is quasi real time!

趣文分享:C 语言和 C++、C# 的区别在什么地方?

线程池运用不当的一次线上事故

使用基于GAN的过采样技术提高非平衡COVID-19死亡率预测的模型准确性
随机推荐
RSA非对称加密算法
Exercise 5
python开发qt程序读取图片的简单流程
如果把编程语言当武功绝学!C++是九阴真经,那程序员呢?
Case analysis of entitycore framework
寻找性能更优秀的不可变小字典
TypeScript(1-2-2)
abp(net core)+easyui+efcore实现仓储管理系统——出库管理之五(五十四)
Chapter 2 programming exercises
Brief VIM training strategy
Looking for better dynamic getter and setter solutions
iptables从入门到掌握
Learn volatile, you change your mind, I see
CMS垃圾收集器
Come and have a look! What is the relationship between AQS and countdownlatch?
WordPress网站程序和数据库定时备份到七牛云图文教程
简明 VIM 练级攻略
C + + opencv4.3 sift matching
CountDownLatch 瞬间炸裂!同基于 AQS,凭什么 CyclicBarrier 可以这么秀?
An online accident caused by improper use of thread pool