Nt1310 Unit 2 Java Case Study

92 Words1 Page
#include #include void main(){ int n,i=0,k,digit; char * ptr[100]; printf("Enter any integer: "); scanf("%d",&n); while(n){ digit = n %10; n = n /10; switch(digit){ case 0: ptr[i++] = "zero"; break; case 1: ptr[i++] = "one"; break; case 2: ptr[i++] = "two"; break; case 3: ptr[i++] = "three"; break; case 4: ptr[i++] = "four"; break; case 5: ptr[i++] = "five"; break; case 6: ptr[i++] = "six"; break; case 7: ptr[i++] = "seven"; break; case 8: ptr[i++] = "eight"; break; case 9: ptr[i++] = "nine"; break; } } for(k=i-1;k>=0;k--){ printf("%s ",ptr[k]);

More about Nt1310 Unit 2 Java Case Study

Open Document