Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

大神们,谁能帮忙看一下我的代码错在哪里啊

Posted by 2011329700227 at 2012-07-04 15:18:19 on Problem 2247
#include<stdio.h>
int main(void)
{
int n,i,a[5842],count=1;
a[0]=1; 
scanf("%d",&n); 
for(i=1;i<=2000000000;i++,count++)
if((i%2==0)||(i%3==0)||(i%5==0)||(i%7==0))
a[count]=i;

while(n!=0)
{

   printf("The %d",n);
		if(n % 10 == 1){
			if(n % 100 == 11)
				printf("th");
			else
				printf("st");
		}
		else if(n % 10 == 2){
			if(n % 100 == 12)
				printf("th");
			else
				printf("nd");
		}
		else if(n % 10 == 3){
			if(n % 100 == 13)
				printf("th");
			else
				printf("rd");
		}
		else
			printf("th");
		printf(" humble number is %d.\n",a[n]);
		}
		} 

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator