Escolar Documentos
Profissional Documentos
Cultura Documentos
Roll No
CERTIFICATE
This is to certify that, Roll No. student of first Semester (CSE) has completed his practical file under the guidance and supervision of undersigned.
Pinky Sethi
Department of CSE
S.NO
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12 13. 14. 15.
PROGRAM
Program to find largest of three numbers. Program to find largest number out of 10. Program to find largest and second largest out of ten numbers. Program to add two matrices. Program to concatenate two strings. Program to check whether the input string is palindrome or not. Program to find factorial of a number entered through Keyboard. Program to swap two numbers. Program to reverse a number entered through keyboard Program to sum digits of a number entered through keyboard. Program to reverse a string. Program to check whether a number is prime or not. Program to implement linear search. Program to Draw Pyramid of stars Program to multiply two matrices.
DATE
SIGN
#include<stdio.h> #include<conio.h> void main( ) { Clrscr(); float a,b,c; printf(Enter any three numbers:); scanf(%f%f%f,&a,&b,&c); if((a>b)&&(a>c)) { printf(Largest of three numbers: %f,a); } else if((b>a)&&(b>c)) { printf(Largest of three numbers: %f,b); } else { printf(Largest of three numbers: %f,c); } getch( );
OUTPUT SCREEN
OUTPUT SCREEN
WRITE A PROGRAM TO FIND LARGEST AND SECOND LARGEST NUMBER OUT OF GIVEN NUMBER
#include<stdio.h> #include<conio.h> void main() { int i,j=0,a[55],n,l=0,sl=0; clrscr(); printf("\n\n\n\n\n\n\n\t\t How many numbers do you want to enter:"); scanf("%d",&n); printf("\n\n\t\t Enter the numbers:"); for(i=0;i<n;i++) { scanf("%d",&a[i]); } for(i=0;i<n;i++) { if(a[i]>l) { l=a[i]; j=i; }} printf("\n\n\t\t Largest element is:%d",l); sl=a[n-j-1]; for(i=0;i<n;i++) { if((a[i]>sl)&&(j!=i)) { sl=a[i]; }} printf("\n\n\t\t Second Largest element is:%d",sl);
getch(); }
OUTPUT SCREEN
printf("%d",b[i][j]); printf(" "); } Printf(\n\n\t\t\t\t ); } for(i=0;i<r1;i++) { for(j=0;j<c2;j++) { c[i][j]=a[i][j]+b[i][j]; }} printf("\n\n\t\tSum of the matrices :"); for(i=0;i<r1;i++) { for(j=0;j<c2;j++) { printf("%d",c[i][j]); printf(" "); } Printf(\n\n\t\t\t\t\t ): } getch(); }
OUTPUT SCREEN
OUTPUT SCREEN
OUTPUT SCREEN
OUTPUT SCREEN
OUTPUT SCREEN
OUTPUT SCREEN
OUTPUT SCREEN
OUTPUT SCREEN
OUTPUT SCREEN
OUTPUT SCREEN
OUTPUT SCREEN
#include<stdio.h> #include<conio.h> #include<process.h> void main() { int a[10][10],b[10][10],c[10][10]; int i,j,m,n,p,q,s; clrscr(); printf("\n\n\n\n\n\n\n\t\t\tInput row and column of matrixA:"); scanf("%d%d",&m,&n); printf("\n\n\t\t\tInput row and column of matrix-B:"); scanf("%d%d",&p,&q); if(n!=p) { printf("\n\n\n\t\t\tMatrix cannot be multiplied"); getch(); exit(0); } printf("\n\n\t\t\tInput Matrix-A:"); for(i=0;i<m;i++) { for(j=0;j<n;j++) { scanf("%d",&a[i][j]); }} printf("\n\n\t\t\tInput Matrix-B:"); for(i=0;i<p;i++) { for(j=0;j<q;j++) { scanf("%d",&b[i][j]);
}} for(i=0;i<m;i++) { for(j=0;j<q;j++) { c[i][j]=0; for(s=0;s<n;s++) c[i][j]=c[i][j]+a[i][s]*b[s][j]; } } printf("\n\n\t\t\tProduct of matrix A and matrix B is: "); for(i=0;i<m;i++) { for(j=0;j<q;j++) { printf("%d ",c[i][j]); } printf("\n\n\t\t\t\t\t\t\t "); } getch(); }
OUTPUT SCREEN