
January 30th, 2004, 07:37 AM
|
|
Authorized User
|
|
Join Date: Jan 2004
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
quote:
for string array you have to take two dimensional char array the above code will not work.
Follow this , it will work.
#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("%s",season[i-1]);
break;
}
}
|
|