How to print all numbers from 1 to N using goto statement in C

1 Answer

0 votes
#include <stdio.h>

int main()
{
    int count = 1, num = 10;

start: //label

	printf("%d ",count);
	count++;

	if (count <= num)
		goto start;

	return 0;
}



/*
run:

1 2 3 4 5 6 7 8 9 10 

*/

 



answered Dec 19, 2023 by avibootz

Related questions

1 answer 180 views
1 answer 175 views
1 answer 196 views
1 answer 152 views
...