一1#include<stdio.h>void main(){int iNum;float fNum=134.23;printf("a=%d\tf=%.2f\n",iNum,fNum); }一2#include<stdio.h>void main(){int a,b,c,sum=0;scanf("a=%d,%d%d",&a,&b,&c);sum=a+b+c;printf("a=%d,b=%d,c=%d\n",a,b,c);printf("sum=%d\n",sum);}一3#include<stdio.h>void main(){char a,b;scanf("%3c%4c",&a,&b);printf("c1=%c,c2=%c\n",a+1,b-1);}一4#include<stdio.h>#include<conio.h>void main(){float a;printf("Enter a:");scanf("%f",&a);printf("The original data is:%f\n\n",a);printf("h=%.2f\n",a);}一5#include<stdio.h>void main(){int a,b,c,s,e;printf("Please input two numbers:\n");scanf("%d%d",&a,&b);c=a+b;s=c*c;e=s+s;printf("%d,%d,%d\n",c,s,e);}一6#include<stdio.h>void main(){float a,b;printf("input a:");scanf("%f",&a);b=5*(a-32)/9;printf("%.0f(℉)=%.2f(℃)\n",a,b);}一7#include<stdio.h>void main(){float a,b,p;printf("win:");scanf("%f",&a);printf("lose:");scanf("%f",&b);p=a/(a+b)*100;printf("赢球百分比:%.2f%\n",p); }二1#include<stdio.h>void main(){float x,y;printf("input x:");scanf("%f",&x);if(x<=1)y=x;else if(1<x<10)y=2*x-1;else if(10<=x)y=3*x-11;printf("y=%.2f\n",y);}二2#include<stdio.h>#include<conio.h>main(){char c;int letters=0,digit=0;printf("请输入一串字符:\n");while((c=getchar())!='\n'){if(c>='a'&&c<='z'||c>='A'&&c<='Z')letters++;else if(c>='0'&&c<='9')digit++;}printf("letters=%d\ndigit=%d\n",letters,digit);getch();}二3#include<stdio.h>#include<math.h>int main(){double x1,x2,a,b,c;scanf("%lf%lf%lf",&a,&b,&c);if(b*b-4*a*c>=0){x1=(-b+sqrt(b*b-4*a*c))/(2*a);x2=(-b-sqrt(b*b-4*a*c))/(2*a);}printf("x1=%lf\nx2=%lf",x1,x2);if(b*b-4*a*c<0)printf("此方程无实数解");}二4#include <stdio.h>void main(){long profit;int grade;float salary=500;printf("输入利润: ");scanf("%ld", &profit);grade= (profit - 1) / 1000;switch(grade){case 0: break;/*profit≤1000 */case 1: salary = profit*0.1; break; /*1000<profit≤2000 */case 2:case 3:case 4: salary = profit*0.15; break; /*2000<profit≤5000 */case 5:case 6:case 7:case 8:case 9: salary = profit*0.2; break; /*5000<profit≤10000 */default: salary = profit*0.25; /*10000<profit */ }printf("提成:%.2f\n", salary);}二5#include<stdio.h>void main(){int a,b,c,t;printf("请输入三个整数:");scanf("%d%d%d",&a,&b,&c);if(b<=a&&a<=c||c<=a&&a<=b)t=a;if(a<=b&&b<=c||c<=b&&b<=a)t=b;if(a<=c&&c<=b||b<=c&&c<=a)t=c;printf("%d\n",t);}三1#include<stdio.h>#define M 2#define N 1000main(){int num,count=0,i,j,lenth=0;printf("从%d到%d之中的守形数有:\n",M,N);for(i=M;i<=N;i++){num=i;j=1;while(num!=0){num=num/10;lenth++;}while(lenth!=0){j=10*j;lenth--;}printf("\n共计%d个",count);}if((i*i-i)%j==0){printf("%d\t",i);count++;}}三2#include<stdio.h>void main(){int i=2,j,m,n,min,max,t=1;printf("请输入正整数m和n:");scanf("%d%d",&m,&n);min=m<n?m:n;max=m<n?n:m;while(i<=min){if(m%i==0&&n%i==0)t=i;i++;}printf("%d和%d的最大公约数为%d\n",m,n,t);for(j=max;max<=j&&j<=m*n;j++)if(j%m==0&&j%n==0){printf("%d和%d的最小公倍数为:%d\n",m,n,j);break;}}三3#include<stdio.h>#include<conio.h>main(){int a,n,count=1;long int sn=0,tn=0;printf("please input a and n\n");scanf("%d,%d",&a,&n);printf("a=%d,n=%d\n",a,n);while(count<=n){tn=tn+a;sn=sn+tn;a=a*10;++count;}printf("a+aa+......=%d\n",sn); }三4#include<stdio.h>void main(){int n,a,sum=0;printf("请输入一个正整数n:");scanf("%d",&n);while(n!=0){a=n%10;sum+=a;n=(n-a)/10;}printf("n的各位数之和为:%d\n",sum); }三5#include<stdio.h>void main(){int n=1,i;for(i=0;i<=10;i++)n=2*(n+1);printf("猴子第一天摘下桃子数目为:%d\n",n); }四1#include<stdio.h>void main(){int m,i,s=1;for(m=1;m<=1000;m++){ s=1;for(i=2;i<=m/2;i++)if(m%i==0)s+=i;if(s==m){printf("%d=1",m);for(i=2;i<=m/2;i++)if(m%i==0)printf("+%d",i);printf("\n");}}}四2#include <stdio.h>#define MAXNUM 1000int factorsum(int n){int index,sum;sum=1; /*1是因子*/for (index=2;index<=n/2;index++)if (n%index==0)sum+=index;return(sum);}void main(){int thisa,thisb,thata;printf("The pairs of amicable number between 1 and %d are:\n",MAXNUM);for (thisa=2;thisa<=MAXNUM;thisa++){thisb=factorsum(thisa);thata=factorsum(thisb);if (thata==thisa)printf("%6d%6d\n",thisa,thisb);}}四3#include<stdio.h>void main(){int a,b,c;for(a=1;a<=33;a++)for(b=1;b<=50;b++)for(c=1;c<=33;c++)if((a*3+b*2+c*3)==100)printf("母鸡只数%d,公鸡只数%d,小鸡只数%d\n",a,b,c);}四4#include<stdio.h>void main(){int a,b,c;for(a=1;a<=33;a++)for(b=1;b<=50;b++)for(c=1;c<=33;c++)if((a*3+b*2+c*3)==100)printf("母鸡只数%d,公鸡只数%d,小鸡只数%d\n",a,b,c);}五1#include <stdio.h>void main(){int a[6]={1,3,5,7,9};int i,m,j;for(i=0;i<5;i++)printf("%5d",a[i]);printf("\nplease input a digit:\n");scanf("%d",&m);a[5]=m;for(i=0;i<6;i++)for(j=0;j<=i;j++){if(a[i]<a[j]){int t=a[i];a[i]=a[j];a[j]=t;}}printf("Now the :\n");for(i=0;i<6;i++)printf("%d ",a[i]);printf("\n");}五2#include<stdio.h>void main(){int a[10],t,i;printf("Enter ten numbers:");for(i=0;i<10;i++)scanf("%d",&a[i]);for(i=0;i<5;i++){t=a[i];a[i]=a[10-1-i];a[10-1-i]=t;}for(i=0;i<10;i++)printf("%d ",a[i]);}五3#include<stdio.h>int main(){int a[15]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; int n,low,high,mid,find;printf("输入一个数:");scanf("%d",&n);low = 0;high = 14;find = 0;while(low<=high){mid = (low+high)/2;if(n == a[mid]){find = 1;printf("找到在第%d个位置\n",mid+1);break; }else if(n > a[mid]){low = mid+1;}else{high = mid-1;}}if(find == 0){printf("无此数\n");}}五4#include<stdio.h>void main(){char d=0;printf("请输入你要转换的字符串:");while(d!='\n'){d=getchar();if (d>='A'&&d<='Z'){d=d+32;}else if (d>='a' && d<='z'){d=d-32;}putchar(d);}}五5#include<stdio.h>void main(){int i,a[20]={1,1};for(i=2;i<20;i++)a[i]=a[i-1]+a[i-2];for(i=0;i<20;i++){if(i%5==0)printf("\n");printf("%-7d",a[i]);}}六1#include<stdio.h>void main(){int a[5][5],i,j;for(i=0;i<5;i++){for(j=0;j<5;j++){a[i][j]='*';printf("%c",a[i][j]);}printf("\n");}}六2#include<stdio.h>void main(){int a[10][10],i,j;for(i=0;i<=9;i++){for(j=0;j<=i;j++)if(i==j||j==0){a[i][j]=1;printf("%d ",a[i][j]);}else{a[i][j]=a[i-1][j-1]+a[i-1][j];printf("%d ",a[i][j]);}printf("\n");}}#include <stdio.h>#define N 3int x,y,exist=0;int isrmax(int a[N][N]){int i;for(i=0;i<N;i++)if(a[x][y]<a[x][i])return 0;return 1;}int iscmin(int a[N][N]){int i;for(i=0;i<N;i++)if(a[x][y]>a[i][y])return 0;return 1;}void scanarray(int a[N][N]){int i,j;for(i=0;i<N;i++)printf("第%d行:",i+1);for(j=0;j<N;j++)scanf("%d",&a[i][j]);}printf("\n");}void printarray(int a[N][N]){int i,j;for(i=0;i<N;i++){for(j=0;j<N;j++)printf("%5d",a[i][j]);printf("\n");}}void main(){int a[N][N];printf("请输入数组各元素的值:\n");scanarray(a);printf("您输入的数组为:\n");printarray(a);for(x=0;x<N;x++)for(y=0;y<N;y++)if(isrmax(a)&&iscmin(a)){printf("鞍点:%d,第%d行,第%d列。