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

Lab-report-revised-1

The document outlines a series of programming tasks for a lab report, including writing programs for calculating areas, sorting numbers, and working with matrices. It also specifies the structure of the lab report, which should include a title, objectives, problem analysis, coding, output, and conclusion. The example provided demonstrates how to calculate the area of a rectangle using C programming.

Uploaded by

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

Lab-report-revised-1

The document outlines a series of programming tasks for a lab report, including writing programs for calculating areas, sorting numbers, and working with matrices. It also specifies the structure of the lab report, which should include a title, objectives, problem analysis, coding, output, and conclusion. The example provided demonstrates how to calculate the area of a rectangle using C programming.

Uploaded by

crgr36181
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Lab Work

1. Write a program to display the area of rectangle.


2. Write a program to calculate area of triangle if base and height are given.
3. Write a program to swap the content of two variables.
4. Write a program to find roots of quadratic equation.
5. Write a program that reads three numbers and displays the largest among them.
6. Write a program that reads three numbers and display middle number.
7. Write a program to input a number and find whether it is exactly divisible by 5 but not by
7.
8. Write a program to read a number and display whether it is positive, negative or zero.
9. Write a program to print Fibonacci series i.e. 0 1 1 2 3 5 8……
10. Write a program to print 10 terms of the following series using for loop1, 5, 9, 13, .
11. Write a program to input an integer number and check whether it is prime or not.
12. Write a program to check whether given number is Armstrong or not.
13. Write a program to display multiplication table of any given number.
14. Write a program to read a number and display the reverse number.
15. Write a program to display first n even numbers.
16. Write a program to display prime numbers between 100 and 200.
17. Write a menu driven program to perform the following task
1. To check the given number is odd or even.
2. To display sum of first n natural number.
3. To check given number is palindrome or not.
4. Exit.
18. Write a program to search an element from ‘n’ elements in an array.
19. Write a program to input ‘n’ numbers and find out largest and smallest number.
20. Write a program to sort ‘n’ elements in an array in ascending order.
21. Write a program to read salaries of 200 employees and count the number of employees
getting salary between 45,000 to 70,000.
22. Write a program to display transpose of given mxn matrix.
23. Write a program to display sum of diagonal elements of 3x3 matrix.
24. Write a program to display sum of each row of given matrix.
25. Write a program to display sum of each column of given matrix.
26. Write a program to read the elements of the two matrices of order 2×3 and perform the
matrix addition.
27. Write a program to input n names and sort them in alphabetical order.
28. Write a program to display whether given string is palindrome or not.
29. Write a program to read line of text from user and count number of vowels, consonants,
spaces and digits.
30. Write a program to find the area and circumference of circle by using function.
31. Write a macro code to display area of circle.
32. Write a recursive program to generate Fibonacci series up to n terms using recursive
function.
33. Write a program to calculate the factorial of a given number using recursive function.
34. Write a program to sort ‘n’ numbers in an array in ascending order by using pointer.
35. Write a program to display transpose of mxn matrix by using pointer.
36. Write a program to read id, name, designation and salary of ‘n’ employee in an organization
and display the information.
37. Write a program that uses structure to read employee ID, name, age and salary of N
employee. Sort them on the basis of name in alphabetical order.
38. Write a program to store stdno, name and mark of ‘n’ students in a data file. Display the
records in appropriate format reading from the file.
39. Write a program to draw circle.
40. Write a program to draw rectangle.
Your lab report to be submitted should include at least the following topics.

1. Title
2. Objective(s)
3. Problem Analysis
4. Coding
5. Output (compilation, debugging & testing)
6. Conclusion.
Pokhara University Faculty of Management Studies

CMP 172 C Programming LAB REPORT

Submitted to
BCSIT Department
Boston International College

In partial fulfillment of the requirements for the Bachelors in Computer Systems and
Information Technology

Submitted by
Name:
Registration Number:

Internal: External:
Name: Name:
Date: Date:
Signature: Signature:

___________________________ ___________________________
Title:
Write a program to display the area of rectangle.

Objective
To understand the sequential programming logic.
Problem Analysis:
Here we have to calculate the area of rectangle reading length and breadth from user. Output is to
display the area so the output parameter is identified as A. Area of rectangle is the multiplication
of its length and breadth.
Input variables Processing Output variables Necessary header
variables/calculations files/functions/macros
l(int) A=l*b A(int) stdio.h
b(int) printf()
scanf()

Coding

#include<stdio.h>
void main()
{
int l,b,A;
printf("Enter length and breadth of rectangle ");
scanf("%d%d",&l,&b);
A=l*b;
printf("Area of rectangle =%d ",A);
}
Output (compilation, debugging and Testing)

Conclusion
The program is focused on calculating Area of rectangle for the given length and breadth. Hence
the area of rectangle is calculated and displayed.

You might also like