using GOTO statement print the following program 1,2,3,4,5,6,7,8,9,10
Answers
Answered by
2
#include <stdio.h>
int main()
{
int counter=1;
int n;
//enter the value of n (range)
printf("Enter the value of n: ");
scanf("%d",&n);
//define label
START:
printf("%d ",counter);
counter++; //increment counter
//condition & goto statement
if(counter<=n)
goto START;
return 0;
}
hope it may help you. ..
int main()
{
int counter=1;
int n;
//enter the value of n (range)
printf("Enter the value of n: ");
scanf("%d",&n);
//define label
START:
printf("%d ",counter);
counter++; //increment counter
//condition & goto statement
if(counter<=n)
goto START;
return 0;
}
hope it may help you. ..
bhoomi18:
that was wrong
Similar questions