自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Kate_Carol的博客

菜鸡的从零开始练习

  • 博客(7)
  • 收藏
  • 关注

原创 菜菜的代码练习2(用c语言计算Π的近似值)

#include<stdio.h>#include<math.h>int main(){ double PI, sum, n, count; PI = 0.0; sum = 0.0; count =0.0; for (n = 1; n <= pow(10,8); n += 2) { sum += ((1. / n) * pow(-1, count)); count++; } ...

2021-11-30 23:18:59 463

原创 菜菜的代码练习1(输入一行字符,分别统计出英文字母,数字,空格和其他字符个数)

#include<stdio.h>int main(){ int letters = 0, numbers = 0, spaces = 0, others = 0; char a; a = getchar(); while (a != '\n') { if ((a >= 'a' && a <= 'z') || (a >= 'A' && a <= 'Z')) ...

2021-11-30 16:58:56 286

原创 菜菜的第五条代码(显示出4个整数中最小的一个)

方法一:#define _CRT_SECURE_NO_WARNINGS#include <stdio.h>int main(){ int a, b, c, d, t; printf("请输入4个整数,系统会为您显示出最小的一个!\n"); scanf("%d %d %d %d", &a, &b, &c, &d); if (a > b) { t = a; a = b; b = t; }...

2021-11-28 01:00:08 989

原创 菜菜的第四条代码(猜数字,猜一个1~500的整数)

#define _CRT_SECURE_NO_WARNINGS#include <stdio.h>#include<stdlib.h>#include<time.h>int main(){ int magic, guess, count; int reply; srand(time(NULL)); do { magic = rand() % 500 + 1; count = 0; ...

2021-11-26 19:54:49 966

原创 菜菜的第三条代码(分段函数的c语言表示,f(x)={)

#define _CRT_SECURE_NO_WARNINGS#include <stdio.h>#include <math.h>int main(){ float x, y; printf("请输入x的值,系统将会为您输出对应的y值!\n"); scanf("%f",&x); if (x<0) { y = 2. * x + 1; printf("y=%.2f", y); }...

2021-11-07 01:49:48 255

原创 菜菜的第一条代码(用c语言求两个整数的平方和)

#define _CRT_SECURE_NO_WARNINGS#include <stdio.h>#include <math.h>int main(){ int a,b,c; printf("请输入2个整数,系统将为你求出其平方和并输出!\n"); scanf("%d %d",&a,&b); c=a*a+b*b; printf("%d",c); return 0;}第一次发的时候搞丢了,难过????...

2021-11-06 02:30:01 1409

原创 菜菜的第二条代码(用c语言求圆的周长和面积)

#define _CRT_SECURE_NO_WARNINGS#include <stdio.h>#include <math.h>#define PI 3.141592int main(){ double r, c, s; printf("请输入圆的半径,系统会为您算出其面积和周长!\n"); scanf("%lf", &r); if (r >= 0) { c = 2. * PI * r; ...

2021-11-06 02:21:53 601

空空如也

空空如也

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

TA关注的人

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