Hi,
I wrote a program which seemed very simple, a switch case nested in a while cicle. The compiler is not giving any error message, and yet when it's running, it starts an endless serie of loops and I do not understand, why.Here the code
#include<stdio.h>
int main ()
{
int id;
float value1 = 0;
float value2 = 0;
printf("Please enter the id number - 1 to 2 - to end\n");
scanf("%d",&id);
while(id<=3)
{
switch(id)
{
case 1:
value1 = 10 * 10;
printf("Value1 is: %f\n",value1);
break;
case 2:
value2 = 20 * 20;
printf("Value2 is: %f\n",value2);
break;
default:
printf("Wrong input\n");
break;
}
}
return 0;
}
Anyone knows the problem?
Thank you very much!!
Bye, bye
Fab2