面試經(jīng)典程序題目有1、234個(gè)數(shù)字能組成多少互不相同且無重復(fù)的_第1頁
面試經(jīng)典程序題目有1、234個(gè)數(shù)字能組成多少互不相同且無重復(fù)的_第2頁
面試經(jīng)典程序題目有1、234個(gè)數(shù)字能組成多少互不相同且無重復(fù)的_第3頁
面試經(jīng)典程序題目有1、234個(gè)數(shù)字能組成多少互不相同且無重復(fù)的_第4頁
面試經(jīng)典程序題目有1、234個(gè)數(shù)字能組成多少互不相同且無重復(fù)的_第5頁
已閱讀5頁,還剩17頁未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

經(jīng)典c程序100==1--1{inti,j,k; for{if(i!=k&&i!=j&&j!=k) /*i、j、k*/}}210016810100268#include"math.h"{longintfor{x=sqrt(i+100); /*x為加上100后開方后的結(jié)果*/ /*y為再加上168后開方后的結(jié)果*/}}3xxyx>yxy然后再用xzx>zxzx{intif(x>y){t=x;x=y;y=t;}*x,y*/{t=z;z=x;x=t;}/*x,z*/{t=y;y=z;z=t;}/*z,y*/printf("smalltobig%ddd\n",x,y,z);}4#include"stdio.h"{inti,j,result;for{{}}}53{longf1,f2;inti;{printf("%12ldif(i%2==0)printf("\n");/*控制輸出,每行四個(gè)*/f1=f1+f2;/*前兩個(gè)月加起來賦值給第三個(gè)月*/f2=f1+f2;/*前兩個(gè)月加起來賦值給第三個(gè)月*/}}62sqrt(這個(gè)數(shù)),如果能被整除,#include"math.h"{intm,i,k,h=0,leap=1;{k=sqrt(m+1);if(leap){printf("%-4d",m);h++;}}printf("\nThetotalis}7{intprintf("'waterflower'numberis:");{{}}}8程序分析:對(duì)nk,然后按下述步驟完成:(1)n,則說明分解質(zhì)因數(shù)的過程已經(jīng)結(jié)束,打印出即可。n<>knkknknkk+1k/*zhengintisdividedyinshu*/{intprintf("\npleaseinputanumber:\n");{{{printf("%d*",i);}}}9題目:利用條件運(yùn)算符的嵌套來完成此題:學(xué)習(xí)成績>=90A,60-89用B60C{intscore;charprintf("pleaseinputascore\n");printf("%dbelongsto%c",score,grade);}10題目:輸入兩個(gè)正整數(shù)mn{inta,b,num1,num2,temp;printf("pleaseinputtwonumbers:\n");{temp=num1;}{}}11#include"stdio.h"{charintletters=0,space=0,digit=0,others=0;printf("pleaseinputsomecharacters\n");{elseif(c=='')elseif(c>='0'&&c<='9')}printf("allinall:char=%dspace=%ddigit=%dothers=%d\n",letters,}12題目:求s=a+aa+aaa+aaaa+aa...a的值,其中a是一個(gè)數(shù)字。例如2+22+222 {inta,n,count=1;longintsn=0,tn=0;printf("pleaseinputaandn\n");{}}136=1+2+3.編程1000{staticintk[10];inti,j,n,s;{n=-{{}}{printf("%disawanshu",j);}}}14第二天早上又將剩下的桃子一半,又多吃了一個(gè)。以后每天早上都吃了前一天剩下10{intday,x1,x2;{x1=(x2+1)*2;/*212*/day--}printf("thetotalis}15{intn,t,number=20;floata=2,b=1,s=0;{}printf("sumis}16{floatn,s=0,t=1;{}}17#include"stdio.h"{intintfact();}intfact(j)intj;{intreturnsum;}18#include"stdio.h"{intvoidpalin(intn);}voidpalin(n)intn;{charnext;{}{}}19512321main(){longge,shi,qian,wan,x;if(ge==wan&&shi==qian)/*個(gè)位等于萬位并且十位等于千位*/printf("thisnumberisahuiwen\n");printf("thisnumberisnota}20題目:Pressanykeytochangecolor,doyouwanttotryit.Pleasehurry#include<conio.h>voidmain(void){intfor(color=0;color<8;{cprintf("Thisiscolor%d\r\n",color);cprintf("Pressanykeytocontinue\r\n");}}21題目:學(xué)習(xí)gotoxyclrscr()#include<conio.h>voidmain(void){gotoxy(15);/*定位函數(shù)*/cprintf("Outputatrow5column1\n");gotoxy(20,cprintf("Outputatrow10column}22#include<stdio.h>voido_world(void){printf("o,}voidthree_{intfor(counter=1;counter<=3;}void{}23#include<stdio.h>#include"math.h"#defineN101{intfor(i=2;i<N;i++)a[i]=i;{{}}24#defineN10{int/*inputprintf("pleaseinputtennum:\n");{/*sorttennum*/if(a[min]>a[j])min=j;}/*outputdata*/printf("Aftersorted\n");}}25{intinttemp1,temp2,number,end,i,j;printf("originalarrayis:\n");printf("insertanewnumber:");{}}}}}26#defineN5{inta[N]={9,6,5,4,1},i,temp;printf("\noriginalarray:\n");}printf("\nsortedarray:\n");}27&程序分析:0&0=0;0&1=0;1&0=0;#include"stdio.h"{inta,b;printf("\40:Thea&b(decimal)is%d\n",b);printf("\40:Thea&b(decimal)is%d}28|程序分析:0|0=0;0|1=1;1|0=1;#include"stdio.h"{inta,b;printf("\40:Thea&b(decimal)is%d\n",b);printf("\40:Thea&b(decimal)is%d}29^程序分析:0^0=0;0^1=1;1^0=1;#include"stdio.h"{inta,b;printf("\40:Thea&b(decimal)is%d\n",b);printf("\40:Thea&b(decimal)is%d}30題目:取一個(gè)整數(shù)a4~7a4410~(~0<<4){unsigneda,b,c,d;}31程序分析:~0=1;#include"stdio.h"{inta,b;printf("\40:Thea's1complement(decimal)is%d\n",b);printf("\40:Thea's1complement(hexidecimal)is%x}經(jīng)典c程序10061--32

1 {intint

1010 }}333a,b,c{intint*pointer1,*pointer2,*pointer3;printf("pleaseinput3number:n1,n2,n3:");if(n1>n2)swap(pointer1,pointer2);if(n1>n3)swap(pointer1,pointer3);if(n2>n3)printf("thesortednumbers}int{intp;}34{intnumber[10];}intnumber[10];{inti;}int{int*max,*min,k,l;int*p,*arr_end;if(*p>*max)max=p;elseif(*p<*min)min=p;}int{int*p;}35{intcharprintf("pleaseinputastring:\n");printf("thestringhas%d}char*p;{intn;{}return}36題目:編寫input()output5#defineN5struct{charnum[6];charname[8];int}stu[N];structstudent{inti,j;{printf("\npleaseinput%dof%d\n",i+1,N);printf("num:");printf("name:");{printf("score}}}structstudent{intprintf("\nNo.NameSco1Sco2Sco3\n");{printf("%-6s%-10s",stu[i].num,stu[i].name);}}{}37/*creatalist*/#include"stdlib.h"#include"stdio.h"structlist{intdata;structlist*next;typedefstructlistnode;typedefnode*link;void{linkptr,head;intnum,i;printf("pleaseinput5numbers==>\n");{if(i==4)ptr->next=NULL;elseptr=ptr-}{printf("Thevalueis==>%d\n",ptr->data);}}38/*reverseoutputalist*/#include"stdlib.h"#include"stdio.h"structlist{intstructlisttypedefstructlistnode;typedefnode*link;void{linkintnum,i;printf("\npleaseinput5data==>\n");{}{printf("Thevalueis==>%d\n",ptr->data);39#include"stdlib.h"#include"stdio.h"structlist{intdata;structlist*next;typedefstructlistnode;typedefnode*link;linkdelete_node(linkpointer,link{if(tmp==NULL)/*deletefirstnode*/returnpointer->next;{if(tmp->next->next==NULL)/*deletelastnode*/else/*deletetheothernode*/return}}voidselection_sort(linkpointer,int{linktmp,btmp;inti,min;{{if(min>tmp->next-}}printf("\40:%d\n",min);}}linkcreate_list(intarray[],int{linktmp1,tmp2,pointer;inti;{tmp2=(link)malloc(sizeof(node));}return}linkconcatenate(linkpointer1,link{linktmp;returnpointer1;}void{intlinkptr;}40{inti,n;{printf("zhuhaoshide}}41{char*s[]={"man","woman","girl","boy","sister"};char**q;intk; }}42#defineN4#include"stdio.h"staticstructman{charname[20];intage;}[N]={"li",18,"wang",19,"zhang",20,"sun",22};{structman*q,*p;inti,m=0;for}43{char*p,s[6];intn;}44{longsum=4,s=4;intj;

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論