Question For the Day.

Thursday, January 31, 2008

#include
int main()
{
int a=10;
switch(a)
{
case '1':
printf("ONE\n");
break;
case '2':
printf("TWO\n");
break;
defa1ut:
printf("NONE\n");
}
return 0;
}
If you expect the output of the above program to be NONE, I would request you to check it out!!
But this is Not the question for the hero of the day. :)

Question for the HERO OF THE DAY02

I thought the following program was a perfect C program. But on compiling, I found a silly mistake. Can you find it out (without compiling the program :-) ?
Be true to yourself. Find the error without compiling and be The hero. (pretty easy i guess)

#include

void OS_Solaris_print()
{
printf("Solaris - Sun Microsystems\n");
}

void OS_Windows_print()
{
printf("Windows - Microsoft\n");

}
void OS_HP-UX_print()
{
printf("HP-UX - Hewlett Packard\n");
}

int main()
{
int num;
printf("Enter the number (1-3):\n");
scanf("%d",&num);
switch(num)
{
case 1:
OS_Solaris_print();
break;
case 2:
OS_Windows_print();
break;
case 3:
OS_HP-UX_print();
break;
default:
printf("Hmm! only 1-3 :-)\n");
break;
}

return 0;
}

About This Blog

  © Blogger template Writer's Blog by Ourblogtemplates.com 2008

Back to TOP