Factorial of A Number
Factorial of A Number
Algorithm:
Output:
Enter any Number 5
120
Fibonacci Series
Algorithm:
#include<stdio.h>
#include<conio.h>
void main( )
{
clrscr();
int f1,f2,f3,i,n;
printf(“Enter the Number\n”);
scanf(“%d”,&n);
f1=1;
f2=0;
i=1;
while(i<=n)
{
f3=f1+f2;
printf(“%d ”,f30;
f1=f2;
f2=f3;
i++;
}
getch();
}
Output:
Enter the Number
1 1 2 3 5 8 13
Addition of Two Matrices
Algorithm:
#include<stdio.h>
#include<conio.h>
void main( )
{
clrscr();
int a[3],b[3],c[3],i,j,k,l,m,g;
printf(“Enter the value of Array A”);
for(i=0;i<=2,i++)
{
for(j=0;j<=2,j++)
{
scanf(“%d”,&a[i][j] );
}
}
printf(“Enter the value of Array B”);
for(k=0;k<=2,k++)
{
for(j=0;j<=2,i++)
{
scanf(“%d”,&b[i][j] );
}
}
printf(“The Addition is”);
for(m=0;m<=2,m++)
{
for(g=0;g<=2,g++)
{
c[m][g]=a[m][g]+b[m][g];
printf(“%d”’\t”,c[m][g]);
}
}
getch();
}
Output:
Enter the value of Array A
3 3 3
4 4 4
5 5 5
5 5 5
4 4 4
3 3 3
The Addition is
8 8 8
8 8 8
8 8 8
To Find The Largest Number Among Three Numbers
Algorithm:
Output:
Enter the Values of X,Y,Z
12 8 10
Algorithm:
Output:
Enter the Decimal Value
14
Algorithm:
Output:
Enter the Number
Number is Odd
Multiplication of Two Matrices
Algorithm:
#include<stdio.h>
#include<conio.h>
void main( )
{
clrscr();
int a[3][3],b[3][3],c[3][3],i,j,k,l,m,x,y;
for(i=0;i<=2,i++)
{
for(j=0;j<=2,j++)
{
printf(“Enter the values”);
scanf(“%d%d”,&a[i][j]&b[i][j] );
}
}
for(k=0;k<=2,k++)
{
for(l=0;l<=2,l++)
{
C[k][l]=0;
for(l=0;l<=2,l++)
{
C[k][l]=c[k][l]+a[l][m]*b[m][l];
}
}
}
for(x=0;x<=2,x++)
{
for(y=0;y<=2,y++)
}
{
printf(“%d”,c[x][y]);
}
getch();
}
To Display Name Of Days Of Week
Algorithm:
friday
To Print Whether The No. Is Prime Or Not
Algorithm:
if(flag==0)
{
printf("No. is prime");
}else{
printf("Not prime");
}
getch();
}
Output:
Enter any no. 2 check
No. is prime
To Print Pascal’s Triangle
Algorithm:
}
Illustration Of Class And Objects
Algorithm:
Output:
enter the name- Kunj Vashishtha
enter the regno- 10408878
The name is-
Kunj Vashishtha
The Regno is-
10408878
Single inheritance
Algorithm:
12
A value is-
452.16
Computer Prractice
Namee : Kun
nj Vashish
htha.
Registtration No
o. : 104
408878.
Sectio
on : H.
Subjecct Code : CS ‐‐ 0112.
Accadmic Year 20
008‐20
009
D
DEPARTM
MENT O
OF ELECTTRONIC
CS & COMMUN
NICATION
SRM INSTITTUTE OF M
MANGEM
MENT & TEECHNOLO
OGY
(SRM
M UNIVER
RSITY)
MOD
DINAGAR,, GHAZIAB
BAD – 201 204
I N D E X
NAME : Kunj Vashishtha REG. NO.10408878
SECTION :H BRANCH :EC