WAP to display the factorial of all number between m and n (both included) when n is greater than m otherwise display message ( loop will not execute. (give the program)
Answers
Answered by
1
solution in c program you can write in any language you what but logic is same.
#include<stdio.h>
int main()
{
int m,n,fact=1;
printf("enter the range of the factorials");
scanf("%d %d",&m,&n);
/*if-condition when n is greater than m it jump into the loop else it will executes the else-block*/
if(n>m)
{
printf("factorials between %d and %d are", m,n);
for(int i=m; i<n; i++)
{
fact = fact*i;
printf("%d \t",fact);
}
}
else
printf("loop will not execute.");
}
Similar questions