自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 字符串排序

#include #include #include int main (){ char ch[5][80]; int i,j; char tr[80]; for(i=0;i<5;i++) { scanf("%s",&ch[i]); } for(i=0;i<5;i++){ for(j=i;j<5;j++)

2018-01-04 17:35:22 137

原创 身份证年月日的提取

#include #include #include int main(){ int year=0,month=0,day=0; int i,j=1; char Id[19]; int age; scanf("%s",&Id); for(i=9;i>5;i--) { year=year+(Id[i]-'0')*j; j*=10;} j=1; for(i=11;i>9;

2018-01-04 17:32:25 529

原创 高速公路超速惩罚

#include <stdio.h>#include <stdlib.h>int main(){ int m,n; double a; scanf("%d %d",&m,&n); a=(double)(m-n)*100/(double)n; if(a<10||m<n) printf("OK"); else if(a<50)

2018-01-03 20:55:13 309

原创 进制转换

#include <stdio.h>int exchange(int a){ if(a == 10){printf("A");return 0;} if(a == 11){printf("B");return 0;} if(a == 12){printf("C");return 0;} if(a == 13){printf("D");return 0;} if(a

2018-01-03 11:54:06 122

原创 通讯录排序

#include<stdio.h>#include<stdlib.h>typedef struct { char name[10]; long int birth; char phone[17];}pInfo;int pInfoSort(pInfo *data, int n){ int i, j; pInfo temp; for (i = 0;

2018-01-03 09:00:34 1259

原创 百钱买百鸡

#include <stdio.h>void main(){ int x=1,y,z; while(x<=19) { y=1; while(y<=33) { z=100-x-y; if(z%3==0&&(5.0*x+3.0*y+z/3.0==100)) printf("x=%d,y=%d,z=%d\n",x,y,z);

2018-01-02 18:01:53 118

原创 鸡兔同笼

#include <stdio.h>void main(){ int s,n,c,d; s=12; n=40; d=(n-2*s)/2; c=s-d; printf("鸡=%d只,兔=%d只\n",c,d); return 0;}

2018-01-02 17:59:10 120

原创 用siwtch和if-else语句将百分制转换为五分制

#include <stdio.h>int main(void){ int x; scanf("%d",&x); switch(x/10) {case 9:printf("A\n");break;case 8:printf("B\n");break;case 7:printf("C\n");break;case 6:printf("D\n");break;

2018-01-02 17:54:24 1756

原创 判断一个数是不是素数

#include <stdio.h>#include <math.h>int main(){ int i,m; int is_prime=1; scanf("%d",&m); for( i=2;i<=m-1;i++) { if(m%i==0) is_prime=0; } if(is_prime==1) p

2017-12-12 19:49:26 283

原创 分解90=2*3*3*5*1

#include <stdio.h>int main(){ int num,i; printf("please input a num:"); scanf("%d",&num); printf("%d=",num); for(i=2;i<=num;i++) while(num%i==0) { num/=i;

2017-12-12 19:14:31 232

原创 找到一个数字的位置

#include <stdio.h>int search(int key,int a[],int length){ int ret=1; int i; for(i=0;i<length;i++) { if(a[i]==key) { ret=i; break; }

2017-11-20 23:27:48 442

原创 Continue语句

#include<stdio.h>main(){ int i,n; for (i=1;i<=5;i++) { printf("please enter n :"); scanf(" %d",&n); if(n<0) continue; printf("n=%d\n",n); } printf(" program is over !\n");}运行结果:

2017-11-12 17:06:50 272

原创 大小写字母的转换

#include<stdio.h>main(){ char ch ; printf("press a key and then press Enter"); ch = getchar(); ch = ch + 32; putchar(ch); putchar('\n');}运行结果:

2017-11-12 16:54:24 432

原创 送给你们的爱

void heart() { printf(” * * \n”); printf(” * * * * \n”); printf(” * * * \n”); printf(“* *

2017-11-12 16:47:01 182

原创 嵌套循环

main() { int i,j,n; long p,sum =0; printf(“input n:”); scanf(“%d”,&n); for (i=1;i<=n;i++) { p=1; for (j=1;j<=i;j++) { p=p*j; } sum = sum +p; } printf(“1!+2!+…+%d=%ld!\n”,n,sum); }

2017-11-12 15:28:07 190

原创 九九乘法表

main() { int i,j; for(i=1;i<=9;i++) { for(j=1;j<=i;j++) { printf(“%d*%d=%d\t”,i,j,i*j); } printf(“\n”); }} 运行结果: 学会了怎样弄九九乘法表

2017-11-12 15:06:53 245

原创 求和

void sum(int begin,int end) { int i; int sum=0; for(i=begin;i<=end;i++) { sum+=i; } printf(“%d到%d的和是%d\n”,begin,end,sum); } int main() { sum(1,10);

2017-11-12 14:48:22 174

原创 for语句

int main() { int i,n,sum; printf(“Input n:”); scanf(“%d”,&n); sum=0; for(i=0;i<=n;i++) { sum=sum+i; } printf(“sum=%d\n”,sum); return 0; } 运行结果:

2017-11-12 14:35:27 246

原创 do while语句

#ibclude<stdio.h> int main() { int a,x,max; printf("Input x:"); scanf("%d",&x); max=0; a=1; do{ max=max+a; a++; }while(a<=x); p

2017-11-12 14:29:31 160

原创 打出*号

int main() { int i,j,k; char space=’ ‘; for(i=1;i<=4;i++) { for(j=1;j<=i;j++) { printf(“%c”,space); } for(k=1;k<=6;k++) { printf(

2017-11-12 14:20:47 265

原创 最大公约数

int main() { int a,b,r; scanf(“%d%d”,&a,&b); while(b!=0) { r=a%b; a=b; b=r; } printf(“%d\n”,a);return 0; } 运行结果:

2017-11-12 14:17:30 141

空空如也

空空如也

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

TA关注的人

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