- 博客(41)
- 收藏
- 关注
原创 W6 C YUYAN
> 61.#include<stdio.h>#include<stdlib.h>main(){ FILE *fp; char a[10],ch; scanf("%s",a); if((fp=fopen(a,"w"))==NULL) exit(0); ch=getchar(); ch=getchar(); while(ch!='#') { fputc(ch,fp); ch=getchar(); } putchar(10); fclose(f
2021-08-18 22:42:43 126
原创 W6.2 C
41.#include <stdio.h>#include <string.h>#include <ctype.h>#define N 9long ctod( char *s ){ long d=0; while(*s) if(isdigit( *s)) {/**********found**********/ d=d*10+*s-'0';/**********found**********/ s++;
2021-08-11 22:25:57 81
原创 二级第三周
#include <stdlib.h>#include <stdio.h>#define N 10double fun(double x[],double *av){ int i,j; double d,s; s=0; for(i=0; i<N; i++) s = s +x[i];/**********found**********/ *av=s/N; d=32767; for(i=0; i<N; i++)
2021-07-29 18:43:19 83
原创 2级第三周
#include <stdlib.h>#include <stdio.h>#define N 10double fun(double x[],double *av){ int i,j; double d,s; s=0; for(i=0; i<N; i++) s = s +x[i];/**********found**********/ *av=s/N; d=32767; for(i=0; i<N; i++)
2021-07-21 15:30:09 48
原创 第三周C十题
21#include<stdio.h>struct student{ int num; char name[10]; int cheng[3];}stu[10];main(){ int i,j; for(i=0;i<10;i++) { scanf("%d%s%d%d%d",&stu[i].num,stu[i].name,&stu[i].cheng[0],&stu[i].cheng[1],&stu[i].cheng[2]); }
2021-07-21 15:28:45 73
原创 暑假二级题目(2)
#include <stdlib.h>#include <stdio.h>#define N 10double fun(double x[],double *y){ int i,j; double av;/**********found**********/ av=0.0;/**********found**********/ for(i=0; i<N; i++) av=av+x[i]/N; for(i=j=0; i<
2021-07-14 16:45:29 48
原创 暑假第二周C语言
11#include<stdio.h>float fish(float n){if(n==5) return (11);else return ((n+1)/n)*(fish(n+1)+1/(n+1));}main(){ printf("%f",fish(1));}12#include<stdio.h>void splitfloat(float x,int *intpart,float *fracpart){ *intpart=(int)x; *f
2021-07-14 16:44:28 38
翻译 C语言暑期第一个十题
1.使用函数求奇数和:输入一批正整数(以零或负数为结束标志),求其中所有奇数的和。要求定义和调用函数even(n),判断整数的奇偶性,当n为偶数时返回1,否则返回0。 #include<stdio.h> even(int n) { if(n%2) return(1); else return(0); } main() { int n,sum=0; scanf("%d",&n); while(n) { if(even(n)) sum+=n; s
2021-07-05 11:23:45 382
原创 二级C 暑期 第一套
#include <stdio.h>#define N 5typedef struct student { long sno; char name[10]; float score[3];} STU;void fun(char *filename, STU n){ FILE *fp;/**********found**********/ fp = fopen(filename, "rb+");/**********found*******
2021-07-05 11:10:25 34
原创 第二星期
car ![在这里插入图片描述](https://img-blog.csdnimg.cn/20210418192830708.png#pic_center)![在这里插入图片描述](https://img-blog.csdnimg.cn/20210418192830441.png#pic_center)![在这里插入图片描述](https://img-blog.csdnimg.cn/2021041819283085.png#pic_center)![在这里插入图片描述](...
2021-04-18 19:29:40 72 1
原创 学习HTML的第一个星期
<!DOCTYPE html><html><head><meta charset="UTF-8"><title>清明</title> <style type="text/css"> h1{ font-size:60px; color:#930; text-align:center; } </style></head&g
2021-04-06 20:50:56 65
原创 88-100
88#include<stdio.h>int main(){ int n; scanf("%d",&n); int c[10],sum=0,count=0; for(;n>=13;n--) { if(n%13==0||n%17==0) { c[count]=n; sum+=c[count]; printf("%d.%d\n",count+1,c[count]); count++; if(coun
2021-02-27 00:56:59 169
原创 77-87
77#include"stdio.h"void main(){ int i,j; for(i=1;i<=6;i++) { if(i%2==0) { for(j=1;j<=2;j++) printf(" "); for(j=1;j<=6;j++) printf("*"); printf("\n");
2021-02-27 00:51:45 156
原创 66-76
66#include<stdio.h>#include<string.h>int main(){ char str[3][20]; char string[20]; int i; for(i=0;i<3;i++) { gets(str[i]);//每换行输入一个字符串 } if(strcmp(str[0],str[1])>0) strcpy(string,str[0]);
2021-02-27 00:46:04 139
原创 55-65
55#include "stdio.h" void main() { int arr[10]; int i,j; int temp; printf("please input the arr:\n"); for(i=0;i<10;i++) scanf("%d",&arr[i]); for(i=0,j=9;i<5;i++,j--) { temp=arr[i];
2021-02-26 19:22:52 112
原创 44-54
44#include "stdio.h" void main() { int arr[3][3]; int i,j; int sum_1=0,sum_2=0; printf("please input the arr:\n"); for(i=0;i<3;i++) for(j=0;j<3;j++) scanf("%d",&arr[i][j]); for(i=0;i<3;i++
2021-02-25 20:40:29 60
原创 33-43
第三十三题#include"stdio.h"int fib(int n);void printFN(int m,int n);int main(){ int m,n,t; scanf("%d%d", &m,&n); printFN(m,n); return 0;}int fib(int n){ if(n==1||n==2) return 1; if(n>2) return fib(n-1)+f
2021-02-24 23:10:14 46
原创 22-32
第二十二题#include"stdio.h"void main(){ int i; for(i=10;;i++) { if(i%5==1&&i%6==4&&i%7==4&&i%11==10) { printf("总人数为:%d\n",i); break; } }}第二十三题#include"stdio.h"void main()
2021-02-24 23:02:54 56
原创 二十一题
#include"stdio.h"void main() { int arr[5][6]; int i,j; //初始化 printf("please input the arr:\n"); for(i=0;i<5;i++) for(j=0;j<5;j++) scanf("%d",&arr[i][j]); for(i=0;i<5;i++) arr[i][
2021-02-24 22:54:39 84
原创 第二十题
#include "stdio.h"void main() { int arr[7][7]; int i,j; //初始化 for(i=0;i<7;i++) arr[i][0]=1; for(i=0;i<7;i++) arr[i][i]=1; for(i=2;i<7;i++) for(j=1;j<=i;j++) arr[i][j]=arr[i-1]
2021-02-24 22:53:57 66
原创 第十九题
#include"stdio.h"#include"math.h"void main(){ int a,b,c; float p,s,l; printf("please input a,b,c:\n"); scanf("%d%d%d",&a,&b,&c); if(a+b>c&&a+c>b&&b+c>a) { l=a+b+c; p=l/2.0;
2021-02-24 22:53:24 44
原创 第十八题
#include<stdio.h>int main(){float I=0,money01, money02, money03, money04, money05;float bonus=0; //奖金money01 = 100000 * 0.1; //十万元奖金money02 = money01 + 100000 * 0.075;//二十万元奖金money03 = money02 + 200000 * 0.05;//四十万元奖金money04 = mon
2021-02-24 22:52:58 48
原创 第十七题
#include"stdio.h"void main(){ float tax,salary; printf("please input the salary:\n"); scanf("%f",&salary); if(salary>=4500) tax=0.2*(salary-1600); else if(salary>3500) tax=0.15*(salary-1600); else if(salary&
2021-02-24 22:51:52 76
原创 第十六题
#include"stdio.h"void main(){ int a,b,c,min; printf("please input the a,b and c:\n"); scanf("%d%d%d",&a,&b,&c); if(a<b) { if(a<c) min=a; else min=c; } else {
2021-02-24 22:51:10 87
原创 第十五题
#include"stdio.h"void main(){ int a,i,b,n; printf("There are following friendly-numbers pair smaller than 3000:\n"); for(a=1;a<=3000;a++) { for(b=0,i=1;i<=a/2;i++) //a的各因子和放在b中; if(!(a%i)) b+=i;
2021-02-24 22:50:31 30
原创 第十四题
#include"stdio.h"void main(){int n;int i,j,k;int count=0;while(scanf("%d",&n)){for(i=1;i<=n;++i) for(j=i+1;j<=n;++j) for(k=j+1;k<=n;++k) if(i*i+j*j==k*k) { printf("[%d,%d,%d],
2021-02-24 22:49:37 51
原创 第十三题
#include <stdio.h>void main(){ int cock,hen,chicken; for(cock=0;cock<=20;cock++) for(hen=0;hen<=33;hen++) { chicken=100-cock-hen; if(5*cock+3*hen+chicken/3.0==100)
2021-02-22 14:55:05 64
原创 第十二题
#include <stdio.h>#include <math.h>int main(){ int n; int i,j,k; int count=0,s; //s是个标志位,如果是素数,让s=1;如果不是素数,让s=0 。 printf("请输入一个正整数N:\n"); scanf("%d",&n); for(i=2;i+2<=n;i++ ) { s = 1; /* 先假设i是素数 */
2021-02-22 14:27:18 47
原创 第十一题
#include"stdio.h"void main(){ int m,n; int sum,i,j; printf("Please enter the range [m,n]:\n"); scanf("%d%d",&m,&n); printf("\n"); printf("the Perfect number is :\n"); for(i=m;i<=n;i++) { sum=0;
2021-02-22 14:23:13 217
原创 第十题
#include"stdio.h"void main(){ int i,j,k,n; printf("The Narcissistic number:\n"); printf("\n"); for(n=100;n<1000;n++) { i=n/100; j=(n-100*i)/10; k=n%10; if(i*i*i+j*j*j+k*k*k==n) p
2021-02-22 14:22:44 40
原创 第九题
#include"stdio.h"void main(){ int i,j,k,n; printf("please input the n:\n"); scanf("%d",&n); printf("\n"); i=n/100; j=(n-100*i)/10; k=n%10; if(i*i*i+j*j*j+k*k*k==n) printf("the %d is Narcissistic number!
2021-02-22 14:22:21 48
原创 第8题
#include"stdio.h"void main(){ int i,j,n; int count=0; printf("请输入n:\n"); scanf("%d",&n); for(i=2;i<=n;i++) { for(j=2;j<i;j++) if(i%j==0) break; if(j==i) .
2021-02-22 14:21:45 158
原创 第7题
#include"stdio.h"void main(){ int x; printf("please input the x:\n"); scanf("x=%d",&x); if(x==0) printf("y=0\n"); else printf("y=%f\n",1.0/x);}
2021-02-22 14:20:59 348
原创 第六题
#include"stdio.h"void main(){ int x,y; printf("please input the x:\n"); scanf("x=%d",&x); if(x<1) y=x; else if(x<10) y=2*x-1; else y=3*x-1; printf("y=%d\n",y);}
2021-02-06 22:32:41 88
原创 第五题
#include"stdio.h"void main(){ int i=1,n; float sum=0; printf("please input the n:\n"); scanf("%d",&n); while(i<=n) { sum+=1.0/i; i++; } printf("the result is %.5f\n",sum); }
2021-02-06 22:32:09 339
原创 第四题
#include"stdio.h"void main(){ int i=1,n; int sum=0; printf("please input the n:\n"); scanf("%d",&n); while(i<=n) { sum+=i; i++; } printf("the result is :%d\n",sum); }
2021-01-30 18:45:21 113
原创 第三题
#include"stdio.h"void main(){ int arr[4],i; int sum=0; float ave; printf("please input the numbers:\n"); for(i=0;i<4;i++) { scanf("%d",&arr[i]); sum+=arr[i]; } ave=sum/4.0; printf("the sum is %d\nthe
2021-01-30 17:10:37 76
原创 第二题
#include"stdio.h"void main(){ float f,c; printf("please input the Fahrenheit :\n"); scanf("%f",&f); c=(f-32)*5/9.0; printf("the Celsius degree is :%.2f \n",c);}
2021-01-30 00:47:01 53
原创 第十六题
输入三个数 求最小的数在这里插入代码片#include"stdio.h"void main(){ int a,b,c,min; printf("please input three numbers"); scanf("%d %d %d",&a,&b,&c); if(a<b) { if(a<c) min=a; else min=c; } else { if(b<c) b=min; else
2021-01-26 18:27:57 149
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人