Sunday, 21 January 2018

Program for Factorial


Program for Factorial
/*factorial*/
#include<stdio.h>
#include<conio.h>
main()
{
int i,n,f=1;
clrscr();
printf("enter the value of n");
scanf("%d",&n);
for(i=1;i<=n;++i)
{
f=f*i;
}
printf("%d",f);
getch();

}

Related Posts:

  • Inputing Integer Number in C Language | best site to learn c programming | c programming codes Inputing Integer Number  The field specification for reading an integer number is:%wd   the percent sign(%) indicates that a conversion specification follows. W is an integer number,that specifies th… Read More
  • Multi Dimensional arraysMulti Dimensional arraysC allows arrays of three or more dimensions. The exact limit is determined by the compiler.The general form of multi-dimensional array is type array-name[s1][s2][s3]----------------------[sm]; whe… Read More
  • Reading Strings From the TerminalReading Strings From the TerminalThe familiar input function scanf can be used with %s format specification to read in a string of characters.        char address[15];        scanf("%s"… Read More
  • Introduction To StringsIntroduction To StringsThe way a group of integers can be stored in an integer array, similarly a group of characters can be stored in a character array . Character array are often called strings.A string constant is a one-di… Read More
  • Initialization Of Two-Dimentional ArraysInitialization Of Two-Dimentional Arrayslike the one-dimensional arrays,two-dimensional arrays may be initialized by following their declaration with a list of initial values enclosed in braces.for example, static int ta… Read More

0 comments:

Post a Comment