I would like to display the output - numbers 1 to 5, followed by 4-5 infinitely. Is there any way i can pass the value of i(4) instead of the character i in goto1. Or is the
Wouldn't a switch accomplish the same thing?
int main()
{
int i = 1;
while (1)
{
switch (i)
{
case 1:
printf(" num is 1 \n");
case 2:
printf(" num is 2 \n");
case 3:
printf(" num is 3 \n");
case 4:
printf(" num is 4 \n");
case 5:
printf(" num is 5 \n");
default:
break;
}
// code to calculate i
i = 4;
// end code to calculate i
}
return 0;
}