You are on page 1of 81

2022

Programming
Fundamental
LAB Manual

5/9/2022
 Name: Noor Fatima
 Department: BSC(CS)
 Semester:
 Roll No: 14

Submitted To:- Ma‟am Romana


Simple Program
Question # 1:-
Write a program to find the sum of five numbers.
Program:-

Output:-
Question # 2:-
Write a program to take two numbers from user and
find their product.
Program:-

Output:-
Question # 3:-
Write a program to take the three number from
user and find their average.

Program:-

Output:-
Question # 4:-
Write a program to read length of one side of cube
and print volume of cube.

Program:-

Output:-
Question # 5:-
Write a program to find the are of a triangle
when its lengths of heigh and base are read from user.

Program:-

Output:-
Question # 6:-
Write a program to find subtraction and
division of two numbers.

Program:-

Output:-
Question # 7:-
Write a program to find the area and perimeter of
rectangle.

Program:-

Output:-
Question # 8:-
Write a program to find the volume of
rectangular box.
Program:-

Output:-
(If Statement)
Question # 9:-
Write a program to print “Hello World” if „x‟ is
greater than „y‟.
Program:-

Output:-
Question # 10:-
Write a program to print square of a number if
number is positive.

Program:-

Output:-
Question # 11:-

Write a program to print the cube of a number if number is


positive.

Program:-

Output:-
Question # 12:-
Write a program by entering your marks. If marks
is greater than 40 then print congratulations and you have
passed.

Program:-

Output:-
Question # 13:-
Write a program by entering your marks. If marks
less than 32 then print sorry and you have failed.

Program:-

Output:-
Question # 14:-
Write a program to print “programming
Fundamentals” if x equals to y.

Program:-

Output:-
Question # 15:-
Write a program to print the number input from
user if it is even.
Program:-

Output:-
Question # 16:-
Write a program to print lab manual if x is less
than y .

Program:-

Output:-
Question # 17:-
Write a program to read the number from the user
and print the given number is positive or negative.

Program:-

Output:-
Question # 18:-
Write a program to print whether the number is
even or odd.

Program:-

Output:-
Question # 19:-
Write a program by using nested if else statement
to check given is even or odd and your program (check even
or odd when number is positive).

Program:-

Output:-
Question # 20:-
Write a program that read marks and print the msg
whether the student passes or failed .

Program:-

Output:-
Question # 21:-
Write a program to compare two values by using if
else statement and print the largest value.

Program:-

Output:-
Question # 22:-
Write a program that inputs a year and find whether
it is leap year or not.

Program:-

Output:-
Question # 24:-
Write a program that inputs the number and find it
is divisible by 5 or not.

Program:-

Output:-
Question # 25:-
Write a program that inputs two numbers and displays
the numbers are equal or not?

Program:-

Output:-
( IF else IF statement)

Question # 26:-
Write a program to compare three numbers and
find which one is largest.
Program :-

Output:-
Question # 27:-
Write a program to perform the arithmetic operators
baised on by the user choice.

Program :-

Output:-
Question # 28:-
Write a program that read the marks of a student and
print her letter grade according to thr following schemes.
Marks Grade
80 – 100 A
70 – 79 B
60 – 69 C
50 – 59 D
40 – 49 E
Below 40 F
Program :-

Output:-
Question # 29:-
Write a program that take number from the user and
check whether its negative , possitive or zero .

Program :-

Output:-
Question # 30:-
Write a program that take a day from the user and
print the nexy day of the week e.g if user enter Monday
print Tuesday .

Program :-

Output:-
Question # 31:-
Write a program that take three angle from the user
and print and check whether the traingle is valid or not .

Program :-

Output:-
( PROGRAMS BY FOR LOOP )

Question # 48:-
Write a program to take a number from the user and
print the table .

Program :-

Output: -
Question # 49:-
Write a program to find the fictorial of a number
take the input from the user .

Program:-

Output:-
Question # 50:-
Write a program and take a number from the user
and check the number is prime or not .

Program :-

Output :-
Question # 51:-
write a program to find the first 10 natural numbers.

Program :-

Output:-
Question # 52:-
Write a program to calculate the hcf of 2 two given
numbers using for loop .

Program :-

Output :-
Question # 53:-
Write a program to print the sum of odd numbers
1+3+5+.....+39.

Program :-

Output :-
Question # 54:-
Write a program to print all even numbers from 1 to 40
and also print their sum .

Program :-

Output :-
(While Loop)

Question # 55:-
Write a program that prints the given sequence of
numbers in a single line .

Program :-

Output :-
Question # 56:-
Write a program to take the number from user and
print the table.

Program :-

Output :-
Question # 57:-
Write a program to find the fictorial and read the
number from user.

Program :-

Output :-
Question # 58:-
Write a program to take the number from user
and check the number is prime or not .

Program :-

Output :-
Question # 59:-
Write a program to find the first 10 natural
numbers.

Program :-

Output : -
Question # 60:-
Write a program to calculate the hcf of 2 two given
numbers using for loop .

Program :-

Output :-
Question # 61:-
Write a program to print the sum of odd numbers
1+3+5+.....+39.

Program :-

Output :-
Question # 62:-
Write a program to print all even numbers from
1 to 20 and also print their sum .

Program :-

Output :-
Question # 63:-
Write a program that prints the given sequence of
numbers in a single line .

Program :-

Output :-
Question #64:-
Write a program to take the number from user and
print the table.
Program :-

Output :-
Question # 65:-
Write a program to find the fictorial and read the
number from user.

Program :-

Output :-
Question # 66:-
Write a program to take the number from user
and check the number is prime or not .

Program :-

Output :-
Question # 67:-
write a program to find the first 10 natural numbers.

Program :-

Output :-
Question # 68:-
Write a program to find the sun of positive
number only.

Program :-

Output :-
Question # 69:-
Write a program to print the sum of odd numbers
1+3+5+.....+39.

Program :-

Output :-
Question # 70:-
Write a program to print all even numbers from
1 to 20 and also print their sum .

Program :-

Output :-
Question # 71:-
Write a program that prints the given sequence of
numbers in a single line .

Program :-

Output :-
( PROGRAMS BY NESTED LOOP )
Question # 72:-
Write a program to print the following pattern of stars
*
**
***
****
*****
Program :-

Output :-
Question # 73:-
Write a program to print the following pattern .
1
12
123
1234
12345
Program :-

Output :-
Question # 74:-
Write a program to print the following pattern .
A
BB
CCC
DDDD
Program :-

Output:-
Question # 75:-
Write a program to print the following pattern .
11111
2222
333
44
5
Program :-

Output :-
Question # 76:-
Write a program to print the following pattern .
12345
6789
10 11 12
13 14
15
Program :-

Output :-
Question # 77:-
Write a program to print the following pattern.
****
***
**
*
Program :-

Output :-
Question # 78:-
Write a program to print the following pattern.
12345
2345
345
45
5
Program :-

Output :-
Question # 79:-
Write a program to print the following pattern.
A
BC
DEF
GHIJ
Program :-

Output :-
( PROGRAMS OF STRINGS )
Question # 81:-
Write a program char type using string.

Program :-

Output :-
Question # 82:-
Write a program to print name using string.

Program:-

Output :-
Question #83:-
Write a program to print string value.

Program :-

Output :-
Question # 84:-
Write a program that compare only two values using
string.

Program :-

Output :-
Question # 85:-
Write a program first name and second name in two
string the concatenate the both strings in third string and
then display it.

Program :-

Output :-
Question # 86:-
Write a program to find the length of a string

Program:-

Output :-
Question # 87:-
Write a program to find how many “a” is in this
sentence “ C++ Programming is awesome ”.

Program:-

Output :-
Question # 88:-
Write a program to read a string from the user and
display it . (e.g. Programming id fun )

Program:-

Output :-
(Switch statement)
Question # 89:-
Write a program to print simple calculator using switch
statement.
Program :-

Output :-
Question # 90:-
Write a program to print a one week day using switch
statement.
Program :-

Output :-
Question # 91:-
Write a program to put X value and then find the
value of X using switch statement

Program :-

Output :-
Question # 92:-
.Write a program to input 3 choices and than print any
1 choice value using switch statement.

Program :-

Output :-
Question # 93:-
Write a program to print you have passed and grade
using switch statement.

Program :-

Output :-
Question # 94:-
Write a program to print a deafult value in switch
statement.

Program :-

Output :-
Question # 99:-
Write a program using without break statement in
switch case.

Program :-

Output :-
Question # 100:-
Write a program to use char data type in switch
statement.

Program :-

Output :-

THE END…………………..!

You might also like