当前位置:网站首页>小青台正式踏上不归路的第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
边栏推荐
- Top 5 Chinese cloud manufacturers in 2018: Alibaba cloud, Tencent cloud, AWS, telecom, Unicom
- What is the database paradigm
- 【Python 1-6】Python教程之——数字
- Top 5 Chinese cloud manufacturers in 2018: Alibaba cloud, Tencent cloud, AWS, telecom, Unicom
- Millet and oppo continue to soar in the European market, and Xiaomi is even closer to apple
- “他,程序猿,35岁,被劝退”:不要只懂代码,会说话,胜过10倍默默努力
- 2018中国云厂商TOP5:阿里云、腾讯云、AWS、电信、联通 ...
- On monotonous stack
- 2020-11-05
- The most complete! Alibaba economy cloud original practice! (Internet disk link attached)
猜你喜欢
Bccoin tells you: what is the most reliable investment project at the end of the year!
我用 Python 找出了删除我微信的所有人并将他们自动化删除了
后端程序员必备:分布式事务基础篇
Workers, workers soul, draw lifelong members, become a person!
2018中国云厂商TOP5:阿里云、腾讯云、AWS、电信、联通 ...
I used Python to find out all the people who deleted my wechat and deleted them automatically
Powershell 使用.Net对象发送邮件
What is the database paradigm
Rabbitmq (1) - basic introduction
用 Python 写出来的进度条,竟如此美妙~
随机推荐
PMP experience sharing
漫画:寻找股票买入卖出的最佳时机(整合版)
AI周报:允许“员工自愿降薪”;公司回应:员工内心高兴满意;虎牙HR将员工抬出公司;瑞典禁用华为中兴5G设备
喜获蚂蚁offer,定级p7,面经分享,万字长文带你走完面试全过程
android基础-CheckBox(复选框)
WLAN 直连(对等连接或 P2P)调研及iOS跨平台调研
2035我们将建成这样的国家
阿里出品!视觉计算开发者系列手册(附网盘链接)
2018中国云厂商TOP5:阿里云、腾讯云、AWS、电信、联通 ...
新型存算一体芯片诞生,利好人工智能应用~
Top 5 Chinese cloud manufacturers in 2018: Alibaba cloud, Tencent cloud, AWS, telecom, Unicom
svg究竟是什么?
Q & A and book giving activities of harbor project experts
PMP考试通过心得分享
2018中国云厂商TOP5:阿里云、腾讯云、AWS、电信、联通 ...
【Python 1-6】Python教程之——数字
Ali tear off the e-commerce label
What is the database paradigm
PMP心得分享
rabbitmq(一)-基础入门