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 270 views
1 answer 255 views
2 answers 256 views
256 views asked Dec 17, 2023 by avibootz
1 answer 242 views
...