previous paper solutions: JNTU 2016 december : factorial
#include <stdio.h>
void main()
{
/*variable declaration*/
int i=1, N;
long int facto=1;//facto will contain the factorial of N
//i is used as counter variable
printf("\n enter a non negitive integer as we want to compute factorial");
printf("\n enter the value of N whose factorail is required:");
scanf("%d",&N);
/*computing the factorial begins*/
while(i<=N)
{
facto=facto*i;
i++;
}
/*displaying the output*/
printf("\n the factorial of given no. %d is %ld",N, facto);
}
----
// Online C compiler to run C program online
#include <stdio.h>
void main()
{
/*variable declaration*/
int i=1, N;
long int facto=1;//facto will contain the factorial of N
//i is used as counter variable
printf("\n enter a non negitive integer as we want to compute factorial");
printf("\n enter the value of N whose factorail is required:");
scanf("%d",&N);
/*computing the factorial begins*/
do
{
facto=facto*i;
i++;
}while(i<=N);
/*displaying the output*/
printf("\n the factorial of given no. %d is %ld",N, facto);
}
#include <stdio.h>
void main()
{
/*variable declaration*/
int i=1, N;
long int facto=1;//facto will contain the factorial of N
//i is used as counter variable
printf("\n enter a non negitive integer as we want to compute factorial");
printf("\n enter the value of N whose factorail is required:");
scanf("%d",&N);
/*computing the factorial begins*/
do
{
facto=facto*i;
i++;
}while(i<=N);
/*displaying the output*/
printf("\n the factorial of given no. %d is %ld",N, facto);
}
----
enter the value of N whose factorial is required:5the factorial of given no. 5 is 120
కామెంట్లు
కామెంట్ను పోస్ట్ చేయండి
దయచేసి మీ సలహాలను సూచనలను స్పష్టంగా పేర్కొనగలరు. plz see that ur comments are 'acceptable' in a value based society.