Loop Control Statements 189
{
int a,fact*l;
clrscr();
printf (" Enter The Number:");
scanf ("%d", &ca);
do
printf (" %d *",a);
fact-fact* a;
a--;
I while (a>=l);
printf C = %dā€,fact);
printf ("n Factorial of Given number is %dā€,fact);
/
QUTPUIj
Enter The Number: 5
5*4*3*2*1* = 120
Factorial of Given number is 120.
Explanation The logic of the program is self-explanatory.
6.78 Write a program to evaluate the series such as l+2+3+..i. Use do-while loop. Where i
can be a finite value. Its value should be read through the keyboard.
#include <stdio.h>
#include <conio.h>
void mainO
{
int idr,aĀ»l;
int saO;
clrscrO ;
printf ("n Enter a number:");
scanf(''%d",&ci);
I
printf C%d + ā€œ,a);
s=s+a;
i
while (a<=i);
printf ("bs=%d",s);
I
OUTPUT;
Enter a number 5
1 + 2 + 3 + 4 +5 s= 15
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.149.253.210