//Factorial of a Number Using For loop in C.
#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,f;
clrscr();
printf("Enter a Number\n");
scanf("%d",&n);
for(i=1,f=1;i<=n;i++)
{f=f*i;}
printf("The factorial is %d",f);
getch();
}
//Multiplication table of a user defined number using for loop in C.
#include<stdio.h>
#include<conio.h>
void main()
{
int i,n,p;
clrscr();
printf("Enter a number\n");
scanf("%d",&n);
for (i=1;i<=10;i++)
{p=i*n;
printf("%d X %d = %d\n",n,i,p);
}
getch();
}
//Multiplication table of All numbers up to 10 using for loop in C.
#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,p,j;
clrscr();
for (i=1;i<=10;i++)
{printf("The multiplication table of %d\n",i);
printf("\n");
for(j=1;j<=10;j++)
{ p=i*j;
printf("%d X %d = %d\n",i,j,p);
printf("\n");
printf("\n");
}
}
getch();
}
Excilent
ReplyDeleteTq bro I write my exam
ReplyDelete