資源描述:
《車牌號(hào)樣本程序》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在應(yīng)用文檔-天天文庫(kù)。
1、#includevoidmain(){inti,a,b,c,d;for(i=0;i<=99;i++){a=i*i/1000;b=(i*i-a*1000)/100;c=(i*i-a*1000-b*100)/10;d=i*i-a*1000-b*100-c*10;if(a==b&&c==d&&a!=c)break;elsecontinue;}printf("%d",i*i);}#include"stdio.h"#include"math.h"#include"conio.h"voidmain(){inti,
2、j,k,c;clrscr();for(i=1;i<=9;i++)for(j=0;j<=9;j++)if(i!=j){k=i*1000+i*100+j*10+j;for(c=31;c*cvoidmain(){inta,b,c,s;for(a=0;a<=9;a++){for(b=0;b<=9;b++){if(a==b)continue;s=a*1000+a*100+b*10+b;for(c=3
3、2;c<=99;c++){if(c*c!=s)continue;printf("%d",s);}}}printf("");}#includevoidmain(){intn;inta;intx1,x2,x3,x4;for(n=32;n<99;n++){a=n*n;x1=a/1000;x2=a%1000/100;x3=a%100/10;x4=a%10;if(x1==x2&&x3==x4&&x1!=x3){printf("Thenumberis:%d^2=%d",n,a);break;}}}#inc
4、lude#includevoidmain(){inta=0,b=0,c,number;doubled;for(a=0;a<=9;a++){for(b=0;b<=9;b++){number=a*1100+b*11;c=sqrt(number);d=sqrt(number);if(a!=b&&c==d)printf("%d",number);}}}上機(jī)題2#include"stdio.h"voidmain(){intDay(intyear,intmonth,intday);intYear(
5、intyear);inttell(intyear,intmonth,intday);intyear1,year2,month1,month2,day1,day2,Bday,Yday,allday,income;Bday=0;Yday=0;scanf("%d%d%d",&year1,&month1,&day1);scanf("%d%d%d",&year2,&month2,&day2);if(tell(year1,month1,day1)&&tell(year2,month2,day2)&&year2>=year1){if
6、(year1!=year2){if(Year(year1))Bday=366-Day(year1,month1,day1)+1;elseBday=365-Day(year1,month1,day1)+1;for(Yday=0,year2--;year2>year1;year2--){if(Year(year2))Yday=366+Yday;elseYday=365+Yday;}allday=Day(year2,month2,day2)+Bday+Yday;}elseallday=Day(year2,month2,day
7、2)-Day(year1,month1,day1)+1;income=allday*50;printf("%d",income);}elseprintf("worrydate");}intDay(intyear,intmonth,intday){intAday,aday=0;intYear(intyear);for(Aday=0,month--;month>=1;month--){switch(month){case1:case3:case5:case7:case8:case12:case10:aday=31;brea
8、k;case4:case6:case9:case11:aday=30;break;case2:{if(Year(year))aday=29;elseaday=28;break;}default:aday=0;}Aday=aday+Aday;}Aday=Aday+day;return(Aday);}intYear(intyear){