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

C Program EXERCISE

This document contains a lab exercise program with 7 questions: 1) Write a program to generate the Fibonacci series up to n terms using a while loop. 2) Write a program that takes a positive number as input, calculates its square, and checks if it is even or odd. 3) Write a program to calculate the total sales, average monthly sales, and months with the highest and lowest sales for a company over 12 months.

Uploaded by

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

C Program EXERCISE

This document contains a lab exercise program with 7 questions: 1) Write a program to generate the Fibonacci series up to n terms using a while loop. 2) Write a program that takes a positive number as input, calculates its square, and checks if it is even or odd. 3) Write a program to calculate the total sales, average monthly sales, and months with the highest and lowest sales for a company over 12 months.

Uploaded by

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

LAB EXERCISE PROGRAM 2

Module-1 OOPS
Ayush Upadhyay
23BAI1231

[1] Write a program to generate Fibonacci series upto n terms using while loop
[2] Write a program that takes a positive number as input, calculates its
square, and checks if it's even or odd. If the input is a negative number or if
the number is the particular case is not considered and it will be skipped using
goto statement.
[3] Write a program that lets the user enter the total sales of XYZ
Company Pvt Ltd for each of 12 months in an array. The program
should calculate and display the total sales for the year, the average
monthly sales, and the months with the highest and lowest sales
[4] Write a program to search an element in a given array. If the searched
element is found in the array, print as “Element Found” else “Element Not
Found” only once.
[5] Write a program to find out how many days and how many weeks have
passed between the dates 01/01/23 to 31/08/23. Also find out how many
days could not get evened out into weeks.
[6] Write a program to read marks of five subjects. Calculate percentage and
print class accordingly. Fail below 35, Pass Class between 35 to 45, Second
Class between 45 to 60, First Class between 60 to 70, Distinction if more than
70 using switch statement.
[7] Construct C programs to print the following patterns using loop

statement.

* * * * *
1
1 * * * * * * * * *
22
333 2 2 * * * * *
4444 3 3 3 * * * *
55555 4 4 4 4 * * * * * *

You might also like