as

Wednesday, 12 November 2014

Do …While Loop in C



Program 1 : Print 1 to 10 numbers using do while.
#include<stdio.h>
void main()
{
  int a=1;
  system("cls");
  do
   {
     printf("\n%d",a);                          
     a++;
   }while(a<=10);
 getchar();
}

Program 2 : Print only multiple of 5 using do while from 1 to 50 numbers .
#include<stdio.h>

void main()
{
  int i=1;
  do
  {
    if(i%5==0)
     {
      printf("\n %d",i);
     }
    i++;
  }while(i<=50);

  getchar();
}


Sponsored Links

Popular Posts

Comments

ShareThis

Google+ Followers

Google+ Badge