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 179 views
1 answer 173 views
1 answer 193 views
1 answer 147 views
...