#include<conio.h>
#include<iostream.h>
void main()
{
clrscr();
int c=1,s=0,i=1;
while(c<=20)
{
s=s+i;
i=i+2;
c++;
}
cout<<"Sum of The First 20 Odd Number is " <<s;
getch();
}
#include<iostream.h>
void main()
{
clrscr();
int c=1,s=0,i=1;
while(c<=20)
{
s=s+i;
i=i+2;
c++;
}
cout<<"Sum of The First 20 Odd Number is " <<s;
getch();
}
can you give the same program using do while loop?
ReplyDelete