随笔分类 -  c语言例子

摘要:#include <stdio.h> #include <math.h> void fc(float a,float b,float c); void fca(float a,float b,float c); main() { float a,b,c; scanf("%f%f%f",&a,&b,& 阅读全文
posted @ 2022-03-09 09:05 myrj 阅读(642) 评论(0) 推荐(0)
摘要:#include <stdio.h> #include <math.h> #include <time.h> double start,finish; int pdzs(int n); main() { int a,b; for(a=1;a<=10000;a++) if(pdzs(a)) { pri 阅读全文
posted @ 2022-03-03 10:24 myrj 阅读(130) 评论(0) 推荐(0)
摘要:#include <stdio.h> #include <math.h> int pdzs(int n); main() { int a,b; for(a=1;a<=100;a++) if(!pdzs(a)) { for(b=2;b<=a;b++) { if(a%b==0) { printf("%d 阅读全文
posted @ 2022-03-03 09:47 myrj 阅读(78) 评论(0) 推荐(0)
摘要:#include <stdio.h> int pdzs(int n); main() { int a,b; for(a=1;a<1000;a++) if(pdzs(a)==1) printf("%d ",a); getchar(); } int pdzs(int n) { int a,b; if(n 阅读全文
posted @ 2022-02-28 22:35 myrj 阅读(405) 评论(0) 推荐(0)
摘要://<序号>处, 并将<序号>删除,使程序运行出正确结果并保存;不得增行或删行,严禁更改程序结构,严禁使用备选语句之外的语句 //程序功能:实现两个字符串的连接(不使用库函数),即把字符串s2连接到字条串s1的后面 #include <stdio.h> main() { int i,j=0; cha 阅读全文
posted @ 2022-02-28 11:12 myrj 阅读(318) 评论(0) 推荐(0)
摘要://<序号>处, 并将<序号>删除,使程序运行出正确结果并保存;不得增行或删行,严禁更改程序结构 //程序功能:求1+2+3+.....+100的值 #include <stdio.h> <1> { int sum,i; sum=0;i=1; <2>(i<=100) { sum=<3>; i=i+1 阅读全文
posted @ 2022-02-28 11:01 myrj 阅读(48) 评论(0) 推荐(0)
摘要:#include <stdio.h> #include <string.h> void midd(char s[],int m,int n,char q[]); void lefta(char s[],int m,char q[]); void righta(char s[],int m,char 阅读全文
posted @ 2022-02-27 17:13 myrj 阅读(130) 评论(0) 推荐(0)
摘要:#include <stdio.h> void midd(char s[],int m,int n,char q[]); main() { int i,j=0; char s1[80],s2[30]; printf(" 请输入字符串:\n") ; gets(s1); puts(s1); midd(s 阅读全文
posted @ 2022-02-27 16:20 myrj 阅读(89) 评论(0) 推荐(0)
摘要:#include <stdio.h> main() { int i,j=0; char s1[80],s2[30]; printf(" 请输入第一个:\n") ; scanf("%s",s1); getchar(); printf(" 请输入第一个:\n"); scanf("%s",s2); get 阅读全文
posted @ 2022-02-27 15:05 myrj 阅读(143) 评论(0) 推荐(0)
摘要:#include "stdio.h" void main() { int i; //任意10个数值,也可以不是8位 unsigned char data[10]={0x12,0x21,0x1A,0xB1,0xC1,0xEB,0xDF,0xCA,0xF6,0xDD}; unsigned char ou 阅读全文
posted @ 2022-02-25 20:47 myrj 阅读(868) 评论(0) 推荐(0)
摘要:#include <stdio.h> int shu(int a,int b); main() { printf("%d",shu(23,56)); getchar(); } int shu(int a,int b) { int aa; aa=(b%10)*1000+b/10*100+(a%10)* 阅读全文
posted @ 2022-02-22 19:14 myrj 阅读(54) 评论(0) 推荐(0)
摘要:同构数:一个数是其平方的尾数:如5 25 ;25 625; #include <stdio.h> main() { int a,b,c; for(a=1;a<10000;a++) if(tgs(a)) printf("%d ",a); getchar(); } int tgs(int x) { in 阅读全文
posted @ 2022-02-22 19:02 myrj 阅读(1043) 评论(0) 推荐(0)
摘要:int m=sizeof(bc)/sizeof(bc[0]),d ; printf("%d ",m) ; 阅读全文
posted @ 2022-02-21 09:29 myrj 阅读(146) 评论(0) 推荐(0)
摘要:#include <stdio.h> main() { int a; scanf("%d",&a); printf("%d",hea(a)); getchar(); } int hea(int a) { int b,gs=0; for(b=1;b<=a;b++) if(b%3==0 && b%10= 阅读全文
posted @ 2022-02-21 08:34 myrj 阅读(17) 评论(0) 推荐(0)
摘要:#include <stdio.h> int bh(int s,int a) { while(s) { if(s%10==a) return 1; s=s/10; } return 0; } main() { int sum=0,a,b,c; for(a=1;a<=1000;a++) if(bh(a 阅读全文
posted @ 2022-01-07 15:44 myrj 阅读(222) 评论(0) 推荐(0)
摘要:#include <stdio.h> int main() { int arr[] = { 22, 34, 3, 32, 33,22,33,33,22,82, 55, 89, 50, 37, 5, 64, 35, 9, 70 }; int len = (int) sizeof(arr) / size 阅读全文
posted @ 2021-12-17 21:06 myrj 阅读(756) 评论(0) 推荐(0)
摘要:#include <stdio.h> int main() { int arr[] = { 22, 34, 3, 32, 82, 55, 89, 50, 37, 5, 64, 35, 9, 70 }; int len = (int) sizeof(arr) / sizeof(*arr); print 阅读全文
posted @ 2021-12-17 20:52 myrj 阅读(788) 评论(0) 推荐(0)
摘要:#include <stdio.h> #define N 10 main() { int shu[N][N]={0},a,b,c; for(a=0;a<N;a++) { for(c=N-1-a;c>=0;c=c-1) printf(" ") ; for(b=0;b<=a;b++) { shu[a][ 阅读全文
posted @ 2021-12-17 16:27 myrj 阅读(897) 评论(0) 推荐(0)
摘要:#include <stdio.h> #include <math.h> main() { int shu[6][6]={0}; int a,b; for(a=0;a<6;a++) { for(b=0;b<6;b++) { if(a==b) shu[a][b]=1; if(a+b==5) shu[a 阅读全文
posted @ 2021-12-17 15:16 myrj 阅读(481) 评论(0) 推荐(0)
摘要:#include <stdio.h> #include <string.h> int main(){ char cs[1024]; gets(cs); int count[256] = {0},i,m; for(i=0; i<strlen(cs); i++) count[cs[i]]++; int 阅读全文
posted @ 2021-12-14 21:06 myrj 阅读(2517) 评论(0) 推荐(0)