Table of Contents
show
Syntax
do
{
statement
}while(expression);
Flow chart
Example
Sum of the series
// Sum of the series
#include<stdio.h>
int main()
{
int terms, sum=0, c=0;
printf("enter number of terms \t");
scanf("%d",&terms);
do
{
sum = sum + c;
c=c+1;
}while(c <= terms);
printf("Sum of series is %d",sum);
return 0;
}
Output
enter number of terms 5
Sum of series is 15
Views: 0