top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Write a C program without using any loop to print numbers from 1 to 100 and 100 to 1 ?

0 votes
541 views
Write a C program without using any loop to print numbers from 1 to 100 and 100 to 1 ?
posted Apr 18, 2017 by Purabi Sarkar

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

/*Program: printing nos. From 1 to 100 and from 100 to 1 without using loops*/

#include<stdio.h>
#include<conio.h>
void main()
{
   int i=1;

   loop:
      printf("%d ",i++);
      if(i<=100)
         goto loop;

   printf("\n\n");
   i--;     //setting i equal to 100

   loop_again:
      printf("%d ",i--);
      if(i>0)
          goto loop_again;
}
answer Apr 18, 2017 by anonymous
...