C语言将一个三位数从小到大输出
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/18 07:09:52
#includemain(){inta=1,b=0,c=0,q;for(;a
intmain(){intinput;inti;intn1,n2,n3;scanf("%d",&input);for(i=100;i
先除以10,输出余数,再除以100,输出余数……while(s/a!=0){printf("%d",s%a);a=a*10;}
#includemain(){FILE*fin,*fout;fin=fopen("maopao!.in","r");fout=fopen("maopao!.out","w");inti,j,t;int
#includevoidmain(){\x09intn,i,j,t,a[10000];\x09printf("请输入正整数N:");\x09scanf("%d",&n);\x09printf("请依次
#includeintmain(void){inta;intge,shi,bai;scanf("%d",&a);ge=a%10;shi=a/10%10;bai=a/100;printf("%d\n",
#includevoidmain(){inta,b,c,d;scanf("%d",&a);b=a/100;c=(a%100)/10;d=a%10;printf("%d",100*d+10*c+b);}
不对,实质上这种情况该用char类型,并判断,因为int可输入多位,例如输入11,12,14你这种算法就不能反向输出
#include#includeintmain(){inti,num,n,ans,tt;while(scanf("%d",&num)!=EOF){ans=0;n=3;//如果要求N位数反转,把n改了就
#include <stdio.h>int main(void){ int num, i,
只是三位数的话,下面的代码就可以了!#includeintmain(){intn;inta,b,c;scanf("%d",&n);a=n%10;b=n/10%10;c=n/100;printf("%d
#include"stdio.h"intmain(){inti,j,a[3][4];for(i=0;i
选择法排序:#include"stdio.h"#defineN10voidmain(){inti,j,k,a[N],temp;printf("请输入10个数字:\n");for(i=0;i
少了几个;赋值语句也有些问题.程序如下,编译通过.#includeintmain(){inta,b,c,t;while(scanf("%d%d%d",&a,&b,&c)!=EOF){if(a
#include"stdio.h"main(){inta,b,c;intt;printf("请输入三个数字:");scanf("%d%d%d",&a,&b,&c);if(a>b){t=a;a=b;b=
#includevoidmain(){inta;intb,c,d;//各个位数上的数字printf("请输入一个三位数:");scanf("%d",&a);b=a/100;//百位c=(a-b*100
#includeintmain(){inta[3];inti;for(i=0;i{scanf("%.1d",&a[i]);}printf("%d\n",a[0]+a[1]+a[2]);return0;
你好.看代码#includevoidsort(int*a,int*b,int*c){intt;t=*a;*a=*a>*b?*a:*b;*b=*a>*b?*b:t;t=*a;*a=*a>*c?*a:*c
#includeintmain(){\x05intn;//\x05printf("请输入一个十位数:");\x05scanf("%d",&n);\x05printf("%d",n%10+n/10);}
#includeintmain(){intn;inti,j;printf("inputn:\n");scanf("%d",&n);for(i=1;i再问:如果我想让它变为122333或者靠右