自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(15)
  • 收藏
  • 关注

原创 贪吃蛇

#define _CRT_SECURE_NO_WARNINGS#include<stdio.h>#include<stdlib.h>#include<Windows.h>#include<time.h>#include<conio.h>#include <MMsystem.h>#pragma comment(lib,"winmm.lib")void start();enum direction { west=-2,

2020-06-08 20:13:51 220 1

原创 哥德巴赫猜想,4~1000=素数之和并输出

# include <stdio.h>int su(int a){ int b,i; b = 0; for (i = 2;i <= a / 2;i++) { if (a % i == 0) { b = 1; break; } } return b;}int main(){ int i, j,a; for (i = 4;i <= 1000;i = i + 2) { for (j=2;j<=i/2;j++) {

2020-06-02 21:50:27 379

原创 求e

e=1+1/1!+2/2!+3/3!+。。。。`# include <stdio.h># include <stdlib.h>double jie(int a){ int i; double b = 1.0; for (i = 1;i <= a;i++) { b = b * i; } return b;}int main(){ double e = 1.0,a=1.0; int i; for (i=1;a>0.000001||a<

2020-06-01 23:14:06 210

原创 求n 项的和(1*2+3*4+5*6+。。。。。+99*100+。。。。)

# include <stdio.h>#include <stdlib.h>int main(){ int a, b, c, d, i,n; scanf_s("%d",&n); a = 0; b = 1; for (i = 1;i <= n;i ++) { a = a + b * (b + 1); b = b + 2; } printf("%d\n",a); system("pause"); return 0;}

2020-05-28 21:53:22 1060 1

原创 输出两个数的最大公约数

# include <stdio.h># include <stdlib.h>int main(){ int a, b, c,i; c = 1; scanf_s("%d %d",&a,&b); if (a > b) { c = a; a = b; b = c; } for (i = a;i > 0;i--) { if (a % i == 0 && b % i == 0) { printf("%

2020-05-28 21:24:42 117

原创 输出100~200之间的素数

# include <stdio.h># include <stdlib.h># include <math.h>int main(){ int a, b, c, d, e,i,j; d = 0; a = 100; for (a = 100;a <= 200;a++) { e = 0; b = sqrt(a); for (i = 2;i <= b;i++) { c = a % i; if (c == 0)

2020-05-28 21:10:29 247

原创 判断素数

# include <stdio.h># include <stdlib.h># include <math.h>int main(){ int a, b, c,d, i; d = 0; scanf_s("%d", &a); b = sqrt(a); for (i = 2;i <= b;i++) { c = a % i; if (c == 0) { d = 1; break; } } if (d == 1

2020-05-28 20:43:18 99

原创 输入三个整数,由大到小输出

# include <stdio.h># include <stdlib.h>int main (void){ int a, b, c,d; scanf_s("%d %d %d", &a, &b, &c); if (a < b) { d = a; a = b; b = d; } if (a < c) { d = a; a = c; c = d; } if (b < c) { d = b;

2020-05-27 22:14:06 267

原创 解二元一次方程a!=0

# include <stdio.h># include <stdlib.h># include <math.h>int main(vido){ float a, b, c,d ,x1,x2,x0; scanf_s("%f %f %f", &a, &b, &c); d = b * b - 4 * a * c; if (d < 0) { printf("无解\n"); } else if (d== 0) { x0

2020-05-27 21:42:20 928

原创 利用公式求Π(前一百项)

Π/2=(2/1)(2/3)(4/3)(4/5)(6/5)(6/7)。。。。# include <stdio.h># include <stdlib.h>int main(void){ float a,c,i,j; a = 1; c = 1; for (i = 2,j=3;i <= 100&&j<=101;i=i+2,j=j+2) { c = c *(i/ j); } a = c * c * 101 * 2; printf("%

2020-05-26 22:12:54 975

原创 输出水仙花数

# include <stdio.h># include <stdlib.h>int main(vido){ int i,a,b,c; for (i = 100;i <= 999;i++) { a = i % 10; b = (i / 10) % 10; c = (i / 100) % 10; if (a * a * a + b * b * b + c * c * c == i) { printf("%d ",i); } } sys

2020-05-26 21:12:03 138

原创 简单的数字金字塔

12 23 3 34 4 4 4# include <stdio.h>void pyramid(int n);int main(){ int n; scanf_s("%d", &n); pyramid(n); return 0;}void pyramid(int n){ int i,j; for (i = 1;i <= n;i++) { for (j = 1;j <= n - i;j++) { printf(" ");

2020-05-26 20:26:44 163

原创 输入三个整数,判断奇偶,并输出。

# include <stdio.h># include <stdlib.h>int main(vido){ int a, b, c; scanf_s("%d %d %d",&a,&b,&c); if (a % 2 == 1) printf("%d是奇数\n", a); else printf("%d是偶数\n", a); if (b % 2 == 1) printf("%d是奇数\n", b); else printf("%

2020-05-26 20:24:28 3133 4

原创 输入N,打印n以下的数字

#include <stdio.h>void PrintN(int N);int main(){ int N; scanf_s("%d", &N); PrintN(N); return 0;}void PrintN(int N){ int i; for (i = 1;i <= N;i++) { printf("%d\n", i); } return 0;}

2020-05-26 20:22:51 188

原创 输入a,b两个数,比较大小,并且输出大的数。

#include <stdio.h>#include <stdlib.h>int max1(int a, int b);int main (){ int a, b,c; scanf_s("%d %d", &a, &b); c=max(a, b); printf("%d",c); system("pause");return 0;}int max1(int a, int b){ int c; if (a > b) {

2020-05-26 20:20:29 4159

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除