当前位置:网站首页>小青台正式踏上不归路的第3天
小青台正式踏上不归路的第3天
2020-11-08 13:52:00 【osc_3vp99iw6】
小青台正式踏上不归路的第3天
看看之前的笔记
再看看现在的水平
不禁流下悔恨的泪水
做个作业做的兴(抓)致(耳)勃(挠)勃(腮)
恨不得拔光头发
屁话真多
好了我要记录每一道明明简单我就是做不出来的题TAT
- 给定两个数,求这两个数的最大公约数
<我讨厌公约数>
#include <stdio.h>
int main()
{
int a,b,c,i;
scanf("%d%d",&a,&b);
if (a < b)
{
c = a; a = b; b = c;
}
for (i = b;i <= a; i--)
{
if (a % i == 0 && b % i == 0)
{
printf("最大公约数为:");
printf("%d\n",i);
break;
}
}
return 0;
}
- 打印1000年到2000年之间的闰年
<我还讨厌闰年>
#include <stdio.h>
int main()
{
int i;
printf("区间闰年有:");
for(i=1000;i<2001;i+=4)
{
if(i%4==0)
{
printf("%d\n",i);
}
}
return 0;
}
- 计算1/1-1/2+1/3-1/4+1/5 …… + 1/99 - 1/100 的值,打印出结果
<做这道题属实用了快40min我是石头>
计算1/1-1/2+1/3-1/4+1/5 …… + 1/99 - 1/100 的值,打印出结果
#include <stdio.h>
int main()
{
int i;
float sum=1;
printf("所求项目之和为:");
for(i=2;i<=100;i++)
{
if(i%2==0)
{
sum+=-1.0/i;
}
else{
sum+=1.0/i;
}
}
printf("%f\n",sum);
return 0;
}
- 1到 100 的所有整数中出现多少个数字9
#include <stdio.h>
int main()
{
int i,j=0;
printf("数字9的个数有:");
for(i=1;i<101;i++)
{
if(i%10==9)
{
j++;
}
}
printf("%d",j);
return 0;
}
- 打印100~200之间的素数
<素数=变态数>
#include <stdio.h>
int main()
{
int i,j;
printf("区间素数有:");
for(i=100;i<=200;i++)
{
for(j=2;j<i;j++)
{
if(i%j==0)
{
break;
}
}
if(i==j)
{
printf("%d\n",i);
}
}
return 0;
}
- 在屏幕上输出99乘法口诀表
#include<stdio.h>
int main()
{
int i=0;
for(i=1;i<=9;i++)
{
int j=0;
for(j=1;j<=i;j++)
{
printf("%d*%d=%d ",i,j,i*j);
}
printf("\n");
}
return 0;
}
- 求10 个整数中最大值
#include <stdio.h>
int main()
{
int a[11],i;
for(i=1;i<=10;i++)
{
scanf("%d",&a[i]);
}
a[0]=a[1];
for(i=1;i<=10;i++)
{
if(a[i]>=a[0]) a[0]=a[i];
}
printf("最大值为:");
printf("%d\n",a[0]);
return 0;
}

总耗时120min;
总error n次;
总崩溃 n+1次;
版权声明
本文为[osc_3vp99iw6]所创,转载请带上原文链接,感谢
https://my.oschina.net/u/4307541/blog/4708183
边栏推荐
- 2035 we will build such a country
- 适合c/c++新手学习的一些项目,别给我错过了!
- Top 5 Chinese cloud manufacturers in 2018: Alibaba cloud, Tencent cloud, AWS, telecom, Unicom
- On monotonous stack
- Entry level! Teach you how to develop small programs without asking for help (with internet disk link)
- 3、 The parameters of the function
- Get PMP certificate at 51CTO College
- 技术总监7年总结,如何进行正确的沟通?
- It's worth seeing! EMR elastic low cost offline big data analysis best practice (with network disk link)
- The network adapter could not establish the connection
猜你喜欢
随机推荐
来自朋友最近阿里、腾讯、美团等P7级Python开发岗位面试题
B站stm32视频学习
Major changes in Huawei's cloud: Cloud & AI rises to Huawei's fourth largest BG with full fire
Share the experience of passing the PMP examination
区块链周报:数字货币发展写入十四五规划;拜登邀请MIT数字货币计划高级顾问加入总统过渡团队;委内瑞拉推出国营加密交易所
Essential for back-end programmers: distributed transaction Basics
What can your cloud server do? What is the purpose of cloud server?
python基础教程python opencv pytesseract 验证码识别的实现
10 common software architecture patterns
Alibaba cloud accelerates its growth and further consolidates its leading edge
STM32CubeIDE下载安装-GPIO基本配置操作-Debug调试(基于CMSIS DAP Debug)
擅长To C的腾讯,如何借腾讯云在这几个行业云市场占有率第一?
原创 | 数据资产确权浅议
最全!阿里巴巴经济体云原生实践!(附网盘链接)
Millet and oppo continue to soar in the European market, and Xiaomi is even closer to apple
这次,快手终于比抖音'快'了!
Huawei has an absolute advantage in the 5g mobile phone market, and the market share of Xiaomi is divided by the market survey organization
啥是数据库范式
新型存算一体芯片诞生,利好人工智能应用~
PMP experience sharing




