Monday, August 26, 2013

Do While Loop

Example 1:

//Do While Loop

#include<stdio.h>
int main()
{
int x=0;
int y=0;
do
{
y=y+x;
printf("%d\n",y);
x++;
}
while(x<=10);
return 0;
}


Example 2:

#include<iostream>
using namespace std;
int main()
{
int x=0;
int y=0;
do
{
y=y+x;
cout<<y<<"\n";
x++;
}
while(x<=10);
return 0;
}

1 comment:

  1. thank you sir....for publishing this site because you define loop is very simple way

    ReplyDelete