Let's tackle this program in this program we will be displaying whole numbers from 
 0 to 20 on the screen. For that we can use any loop but here we have used do while
 loop as we are using do while loop what it does is  it will print the statement number
 of times by increasing value but we have a feature in do while that it will print once
 always if the statement is wrong as it is a exit control loop.
  Program
  #include<stdio.h>
  #include<conio.h>
   void main()
   {
    int n=0;
     do {
     printf("%d\t",n);
     n++;
     } while(n<=20);
   }
   Output:
    As you can see in the output screen we have used \t in the program which always gives a tab space           after every output. As soon as the value of n gets more than 20 it will come out of loop and program       will stop.
       << Back


Post a Comment

Previous Post Next Post