# LAB Program

Write a C program to find a factorial of the given number. Write a C program to perform arithmetic operation using switch. Write a C program to find the maximum value of given three numbers. Write a C program to find the given number is odd or even. Write a C program to converting character from lower case to upper case vice versa. Write a C program to find Fibonacci series of a given number. Write a C program to find the string length and concatenation of string. Write a C program to arrange the names in alphabetical order. Write a C program to perform matrix addition. Write a C program to process the student records using structure. Write a C program to print the employee details using union. Creating a document (Bio data) and manipulating the text using Microsoft (MS) Word. Creating a document in MS Word with Scientific Notation using Math Editor. Creating a Flow Chart using Drawing tools in MS Word. (a) Creating and formatting a student information table using MS-Word (b) Converting table to text and text to table. Implementation of Mail Merge and Letter Preparation. Creating an Employee Database using MS-Excel and preparing different charts. To write a program to find the largest of the three numbers. ALGORITHM: Step-1 Start the program Step-2 Enter the three numbers

c. { if(a>c) printf(“\t%f”.b. printf(“\n enter the three numbers”). if(a>b). printf(“\n largest value is”).&c). If greater then assign large to next number Step-5 Compare the next number with large Step-6 Do the step-4 Step-7 Print the larger value of the three number Step-8 Stop PROGRAM: //TO FIND THE LARGEST OF THE THREE NUMBERS #include<stdio. else printf(“\n\t%f”.&b. } else .Step-3 Assign large to first number step-4 Check the next number is greater then the large.&a. scanf(“%f %f %f “.c).h> main() { float a.a).

b=c. Step-6 Every increment in the loop prints the value of fib.b). Step-5 fib=fib+a. a=b. If not zero go further. else printf(“\n\t %f”.{ if (c>b) printf(“\n\t%f”. If zero print Zero value. } } SAMPLE OUTPUT: Enter the three numbers 93 43 23 The biggest of three number is 93 To write a program to generate the fibbonaci series ALGORITHM: Step-1 Start the program Step-2 Enter the number Step-3 Check the number whether the number is zero or not.c). Step-7 After the execution of the loop stops the program PROGRAM: //TO PRINT THE FIBBONACI SERIES UPTO GIVEN NUMBERS . Step-4 Set a loop up to the given number.

a=b.i.fib=0.i<num. else { for(i=0.i++) { fib=fib+a. printf(“Enter the number”).a=0. scanf(“%d”. } } } SAMPLE INPUT AND OUTPUT Enter the number 5 FIBONACCI SERIES .#include<stdio. printf(“\n FIBBONACI SERIES\n”). printf(“%d\t”.&num).fib).b=1. if(num==0) printf(“0”).h> main() { int num. b=fib.

. for(i=1. scanf(“%d”.num.i.i<=num.h> main() { int fact=1.i++) { fact=fact*i.&num).num.fact).01123 To write a program to find the factorial of the given number ALGORITHM: Step-1 Start the program Step-2 Enter a number Step-3 Set a loop to find the factorial of the given number using the formula Fact=Fact*I Step-4 Print the factorial of the given number Step-5 Stop PROGRAM: //TO FIND THE FACTORIAL OF THE GIVEN NUMBER #include<stdio. printf(“Enter the number”). } printf(“The factorial of %d is %d”.

} SAMPLE INPUT AND OUTPUT: Enter the number 5 The factorial of 5 is 120 To write a program to find the string length and concatenation of string. ALGORITHM: Step-1 Start the program Step-2 Enter the string Step-3 Find the string length using the function strlen() Step-4 Print the string length of the entered string Step-5 concatenation the two string using the function strcat() Step-6 Print the concatenated string Step-7 Stop PROGRAM: // TO FIND THE STRING LENGTH OF THE STRING #include<stdio. scanf(“%s”.h> #include<string. .h> main() { char str1[50].str1).str2[]=” WELCOME”. int len. printf(“Enter the string…”).

ALGORITHM: Step-1 Start the program Step-2 Enter the row and column of the matrix Step-3 Enter the elements of the A matrix Step-4 Enter the elements of the B matrix Step-5 Print the A matrix in the matrix form Step-6 Print the B matrix in the matrix form Step-7 Set a loop up to the row Step-8 Set a inner loop up to the column Step-9 Add the elements of A and B in column wise and store the result in C matrix Step-10 After the execution of the two loops.strlen(str1)).str1.str2)). Print the value of C matrix Step-11 Stop PROGRAM: .strlen(str1).strcat(str1. printf(“\nTheconcatenation string length is %d and its string is %s”. } SAMPLE OUTPUT: Enter the string… mech The string length of mech is 4 The concatenation string length is 17 and its string is mech WELCOME To write a program to give the addition of two matrixes.printf(“\nThe string length of %s is %d”.

&m.i<m. for(i=0. } printf(“\nThe elements of A matrix”).j<n. for(i=0.&a[i][j]).i++) { for(j=0.c[25][25]. } printf(“\nEnter the elements of B matrix…”). scanf(“%d %d”.i++) { for(j=0.// FIND THE ADDITION OF TWO MATRIXES #include<stdio.i<m.&n). . printf(“\nEnter the elements of A matrix…”).i++) { printf(“\n”).j++) scanf(“%d”.j<n.m. printf(“Enter the rows and column of two matrixes…\n”).i.h> main() { int a[25][25].j++) scanf(“%d”.&b[i][j]).j.i<m. for(i=0.b[25][25].n.

j++) printf(“\t%d”. } } } SAMPLE OUTPUT: Enter the rows and column of two matrixes… 3 3 . for(j=0.c[i][j]).j<n. for(i=0.i<m.j++) printf(“\t%d”. printf(“\t%d”.for(j=0.i<m.i++) { printf(“\n”).a[i][j]).j<n. } printf(“\nThe elements of B matrix”).j++) { c[i][j]=a[i][j]+b[i][j].b[i][j]).i++) { printf(“\n”).j<n. } printf(“\nThe addition of two matrixes”). for(i=0. for(j=0.

Enter the elements of A matrix… 1 2 3 4 5 6 7 8 9 Enter the elements of B matrix… 1 2 3 4 5 6 7 8 9 The elements of A matrix 1 2 3 4 5 6 7 8 9 The elements of B matrix 1 2 3 4 5 6 7 8 9 The addition of two matrixes 2 4 6 8 10 12 14 16 18 To write a program to process the student records using structures. roll no. ALGORITHM: Step-1 Start the program Step-2 Initialize the structure variable Step-3 Enter the number of student Step-4 Set a loop up to the number of student Step-5 Enter the student name. roll no. average marks Step-6 Find their grades Step-7 Print the student name. average and their grade .

printf(“\nEnter the roll no of the student”). printf(“Enter the name”).regno). int avg.i++) { printf(“\n student[%d] information:\n”.stud[i]. char regno[25].stud[i].no.h> main() { struct student { char name[25].&no). char grade.*pt. scanf(“%s”.i<no. .i+1). for(i=0. printf(“Enter the number of the students…”). int i. } stud[50]. scanf(“%s”.Step-9 Stop PROGRAM: //STUDENT RECORD USING POINTER AND STRUCT #include<stdio. scanf(“%d”.name).

printf(“%10d \t %c\n”.pt<stud+no.&stud[i]. scanf(“%d”. else if(pt->avg<50) pt->grade=’C’.avg).pt<stud+no. for(pt=stud. else if(pt->avg<70) pt->grade=’B’. printf(“NAME REGISTER-NO AVERAGE GRADE\n”).pt->avg.pt->regno).pt++) { if(pt->avg<30) pt->grade=’D’.pt->name. } pt=stud. } } .pt->grade).pt++) { printf(“%-20s%-10s”. else pt->grade=’A’. for(pt=stud.printf(“\nEnter the average value of the student”). } printf(“\n”).

SAMPLE OUTPUT: Enter the number of the students 3 student[1] information: Enter the name MUNI Enter the roll no of the student 100 Enter the average value of the student 95 student[2] information: Enter the name LAK Enter the roll no of the student 200 Enter the average value of the student 55 student[3] information: Enter the name RAJA Enter the roll no of the student 300 Enter the average value of the student 25 NAME REGISTER-NO AVERAGE GRADE MUNI 100 95 A LKA 200 55 B RAJA 300 25 D .