what is the coding of display the factorial of a number
using array and function?
Answer Posted / balaji ganesh
#include<stdio.h>
int fact(int m)
{
int i,f=1;
for(i=m;i>0;i--)
f=f*m--;
return f;
}
void main()
{
int n,s;
clrscr();
scanf("%d",&n,printf("enter the number:"));
s=fact(n);
printf("factorial of %d is=%d",n,s);
getch();
}
| Is This Answer Correct ? | 6 Yes | 1 No |
Post New Answer View All Answers
Write a code to achieve inter processor communication (mutual exclusion implementation pseudo code)?
FILE *fp1,*fp2; fp1=fopen("one","w") fp2=fopen("one","w") fputc('A',fp1) fputc('B',fp2) fclose(fp1) fclose(fp2)} a.error b. c. d.
Is this program statement valid? INT = 10.50;
A banker has a seif with a cipher. Not to forget the cipher, he wants to write it coded as following: each digit to be replaced with the difference of 9 with the current digit. The banker chose a cipher. Decipher it knowing the cipher starts with a digit different than 9. I need to write a program that takes the cipher from the keyboard and prints the new cipher. I thought of the following: Take the input from the keyboard and put it into a string or an array. Go through the object with a for and for each digit other than the first, substract it from 9 and add it to another variable. Print the new variable. Theoretically I thought of it but I don't know much C. Could you give me any kind of hint, whether I am on the right track or not?
What are the disadvantages of external storage class?
What is data structure in c and its types?
Explain the ternary tree?
Why do we use return in c?
The postoder traversal is 7,14,3,55,22,5,17 Then ur Inorder traversal is??? please help me on this
What is the right type to use for boolean values in c?
What is a double c?
Is int a keyword in c?
Why is c known as a mother language?
What are the different types of pointers used in c language?
Define recursion in c.