0% found this document useful (0 votes)
0 views

Lab sheet

The document outlines the structure and requirements for a C programming lab report, including sections such as cover page, objectives, problem analysis, algorithm, flowchart, coding, output, and discussion. It provides detailed lab exercises across multiple sheets focusing on various programming concepts like basic operations, control statements, looping, functions, arrays, strings, structures, and pointers. Each lab sheet contains specific programming tasks aimed at enhancing understanding and application of C programming principles.

Uploaded by

Shiva Shrestha
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

Lab sheet

The document outlines the structure and requirements for a C programming lab report, including sections such as cover page, objectives, problem analysis, algorithm, flowchart, coding, output, and discussion. It provides detailed lab exercises across multiple sheets focusing on various programming concepts like basic operations, control statements, looping, functions, arrays, strings, structures, and pointers. Each lab sheet contains specific programming tasks aimed at enhancing understanding and application of C programming principles.

Uploaded by

Shiva Shrestha
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

C PROGRAMMING LAB SHEETS

Your lab report to be submitted should include the following topics:

1. Cover page
2. Title
3. Objectives(s)
4. Problem Analysis
5. Algorithm
6. Flowchart
7. Coding
8. Output (compilation, debugging & testing )
9. Discussion & Conclusion

LAB SHEET #1 Basic program

Title:

Write a program to calculate the volume of a CUBOID having its height (h = 10cm), width (w =
12cm) and depth (d = 8cm).

Objective (s):

 To familiar with syntax and structure of C-programming.


 To learn problem solving techniques using C.

Problem Analysis:

 Input variables: h, w and d


 Calculation: Vol = h * w * d
 Output variable: Vol

Algorithm:

Step 1: Start

Step 2: Define variables: h(int), w(int), d(int), Vol(int)

Step 3: Assign value to variables: h = 10, w = 12, d = 8

Step 4: Calculate the volume as: Vol = h * w *d

Step 5: Display the volume (Vol)

Step 6: Stop
Flowchart:

START

INT h, w, d, Vol

Vol = h * w * d

Display Vol

STOP

Program Code:

#include<stdio.h>

#include<stdlib.h>

Int main()

int h = 10;

int w = 12;

int d = 8;

int Vol = h * w * d;

printf("\n Volume of cuboid = %d", Vol);

return 0;

Output:

Volume of cuboid: 960

Discussion and Conclusion:


The program is focused on the calculation of volume of cuboid for the given height, width and
depth. I understood the basic structure of C programming including the meaning of header file and
steps of problem.

Lab exercises:

1. Write a program to display to display "hello world" in C.


2. Write a program to add two numbers (5 & 7) and display its sum.
3. Write a program to multiply two numbers (10 & 8) and display its product.
4. Write a program to calculate area of a circle having its radius (r = 5).
5. Write a program to calculate simple interest for a given P = 4000, T = 2, R = 5.

LAB SHEET 2 Operator

Lab Exercises:

1. Write a program to take input of name, roll no and marks obtained by a student in 5 subjects
each have its 100 full marks and display the name, roll no with percentage score secured.
2. Write a program to declare two integers and one float variables then initialize them to 10, 15
and 12.6. Also print he variable values in the screen.
3. Write a program to check odd or even number.
a. Using modulus operator
b. Using bitwise operator
c. Without using bitwise and modulus operator
d. Using conditional operator
4. Print the value of y for given x = 2 & z = 4 and analyze the output.
a. y = x++ + ++x;
b. y = ++x + ++x;
c. y = ++ + ++x + ++X
d. y = x > Z
e. y = x > z ? x : z ;
f. y = x & z;
g. y = x>>2 + z<<1;
5. write a program to print the size of char, float, double and long double data types in C.

LAB SHEET #3 User Input / Output

Lab Exercise:

1. Get input of your name, address, age in years, weight and height from keyboard and display the
information .
2. Demonstrate the differences among getch(), getche(), getchar(). Demonstrate the difference
between scanf() & gets(), print() & puts().
LAB SHEET #4 Control Statement

1. Program to display the largest number between any two numbers.


2. Program to display the smallest number between any two numbers.
3. Develop program to test even or odd number of an integer variable using if-else statements.
4. Write a program to input marks of 5 subjects for a students. Display the rank of each subjects
and also the result of total marks and percentage obtained with his / her rank in the class. The
rank is categorized as fail (marks < 40%). First (marks between 65 to 80%), distinction (marks
between 80 to 95%), extra ordinary (marks above 95 to 100%).
5. Write a program to find the largest and smallest among three entered numbers and also display
whether the identified largest / smallest number is even or odd.
6. Write a program to check whether input alphabet is vowel or not using if-else and switch
statement.
7. Write a program to get input of two or higher integer number and display in reverse order.
8. Write a program that asks a number and test he number whether it is multiple of 5 or not,
divisible by 7 but not by 11.
9. Write a program to check whether the entered year is leap year or not (a year is leap year if it is
divisible by 4 and divisible by 100 or 400).
10. Write a program to read the values of coefficients a, b and c of a quadratic equation ax2 + bx +_ c
= and find the root of the equation.

LAB SHEET #5 Looping Statement


1. Develop program to display 1 to 20 elements using For loop, While Loop, Do-While.
2. Program to display the Fibonacci series.
3. Program to display the series 1, 5,9,13 up to 13 terms
4. Program to table of one.
5. Program to table of any number.
6. Print natural numbers from 1 to n.
7. Print natural numbers from 1 to n in reverse order.
8. Print sum off natural number from 1 to N.
9. Print A B C ….. Z.
10. Print a b c .. z.
11. Print ASCII value of alphabet from A to Z.
12. Factorial of any numbers.
13. Power of any numbers.
14. LCM of two numbers.
15. HCF of two numbers.
16. Check given numbers is prime or not.
17. Print prime numbers between 1 to N.

LAB SHEET #6 Function

1. Program to display “Welcome to My School” using function.


2. Program to find the summation of two variables using function.
3. Program to find the largest and smallest numbers using functions.
4. Program to find the factorial of any integer variable using recursion.
5. WAP to call function by Value and Call by Reference.
6. Rectangle area using function.
7. Circle area using function.

LAB SHEET #7 Array

1. Write a program to input 5 numbers in an array variable and display them.


2. Write a program to input the age of 20 students and count the number of students 23 22
Curriculum Development Centre Final Curriculum Computer Engineering 9-10 having age between
20 and 25.
3. Write a program to find the largest number among ‘ n’ numbers
4. Write a program to initialize an array variable with 10 elements and display on the screen(not using
loop)
5. Write a program to initialize an array variable with 10 elements and display on the screen( using For
loop)
6. Write a program which holds string data type as elements of an array of size 10 and display using For
Loop
7. Write a program to display elements of an array input through the keyword.
8. Write a program to multiply 2X2 array elements and display the output on the screen
9. Write a program to find whether the elements of an array is even or odd number. Print all the
elements of array.
10. User input in single dimensional array.
11. Print all the elements of array in reverse order.
12. Find sum of all the elements of array.
13. Addition of single dimensional array.
14. Print all even number of single dimensional array.
15. Print all odd numbers of single dimensional array.
16. Find the maximum and minimum value of from single dimensional array
17. Find the minimum value from single dimensional array.
18. Print all the elements of double dimension array.
19. Find sum, addition, subtraction, multiplication and double dimensional array.
20. Transpose of double dimension array.

LAB SHEET #8 String

1. Print entered string.


2. Count the character in a string.
3. To read a string user then print its reverse on monitor.
4. Check given string is palindrome or not.
5. Check mobile numbers length is correct or not.
LAB SHEET #9 Structure

1. Write a program to create an structure of book having fields ‘title’, ‘author’, ‘Publication’, ‘Price’.
2. Write a C program that takes roll_no, fname, lname of 5 students and print the same record on the
screen.
3. Addition, subtraction, multiplication and division using structure.

LAB SHEET #10 Pointer


1. WAP to define a pointer variable which holds the address of a normal variable. And print the value
stored at normal variable.
2. Test a program how pointer variable holds the address of another variable.
3. WAP to find the of value stored at pointer variable using deference operator.
4. Accessing data through pointer.
5. Pointer arithmetic. (+, - , *, /)

You might also like