Thread: Help on C Array
View Single Post
  #4 (permalink)  
Old January 2nd, 2004, 06:23 AM
ÕÅÃÍ
Guest
 
Posts: n/a
Default

I have just learned c for one term! hope it is right!

#include<stdio.h>

void main()
{
   int num;
   char season[]={"Jan","Feb","Mar",......"Dec"};

   printf("Input your number:");
   scanf("%d",&num);

   for(int i=1;i<=12;i++)
       if(num==i) {
         printf("%c",season[i-1]);
         break;
        }
}


Reply With Quote