Lab Programs For Practice PDF
Lab Programs For Practice PDF
12345
1234
123
12
1
4. WAP to Print full pyramid of *:
*
**
***
****
*****
2 Assignment:-
1. Write a program to find the cube of a number?
2. Write a program to find the sum of two numbers?
3. Write a program to find the multiplication of two numbers?
4. Write a program to find addition and multiplication of two numbers?
5. Write a program to find addition and multiplication of three numbers?
6. Write a program to swap two numbers?
7. Write a program to find the area of square?
8. Write a program to find the area of rectangle?
9. Write a program to find the area of circle and circumference of circle?
10. Write a program to find the average of 5 marks of a student?
11. Write a program to convert Centigrade to Fahrenheit?
3 Assignments:
1. Write a program to show the result of two input values (int a =5 and b=2) using
arithmetic operators +,-,*,/ and %.
2. Write a program to show the use of increment and decrement operators by taking a
input variable int a=3; find x, when x=a++, x=++a, x=--a, x=a--?
3. Write a program to show the result (find a) of a input value (int b=5) using
assignment operators for expressions: a=b, a+=b, a-=b, a*=b?
4. Take two inputs and find the bitwise operations &, I, ~, ^, and shift a number by using
the operators >>,<<?
5. Write a program to find the ASCII value of a character entered?
6. Write a program to find the character for an ASCII value entered?
4 Assignment:
1. Write a program by entering a number and check whether it is even using only IF
statement?
2. Write a program to check from the three numbers entered to find the largest using
only IF statements?
3. Write a program by entering a number and check whether it is even or odd using only
IF Else statement?
4. Write a program by entering the age of a person and check whether eligible to vote or
not using only IF Else statement?
5. Write a program to check whether a character entered is Vowel or Consonant using If
Else?
6. Write a program to Design an ATM machine which only accepts the amount entered:
Rs 500, Rs 1000, Rs 1500, and Rs 2000 using If Else If statements?
7. Write a program to find the Grade of a student by entering the mark/percentage using
if else if statements (Hint: marks distribution with Grade- 90-100:O, 80-89:E,70-
79:A,60-69:B,50-59:C,40-49:D,less than 40: Fail)?
8. Write a program to check the eligibility of candidate for a particular job if he scored
50% in 10th, 55% in 12th, and 55% in B.Tech using Nested IF statements?
9. Write a program to Design an Restaurant Menu by entering the options by using only
SWITCH case (Hint:- 1:Tea, 2: Coffee, 3: Ice Cream, 4: Milk, 5: Bread, Default:
Dishes not available)?
10. Write a program to Design an Restaurant Menu by entering the options by using only
Nested SWITCH cases (Hint:- options- 1: Veg (options- 1: Veg Biriyani,2:Veg
Pulao), 2: Non Veg (Options- 1: Fish Curry, 2: Egg Curry))?
5: Class Assignments (using FOR loops only)
1. Write a program in C to display the first 10 natural numbers.
2. Write a C program to find the sum of first 10 natural numbers and find the average of
it.
3. Write a program in C to enter a number and find the total sum from 1 to that number
and find the average.
4. Write a program in C to read 10 numbers from keyboard and find their sum and
average
5. Write a program in C to display the cube of the number upto given an integer.
6. Write a program in C to display the multiplication table of a given integer.
7. Write a program in C to enter a number (hint: >10) and find the odd numbers between
1 to that number, and find the sum and average of it.
8. Write a program in C to display the pattern like right angle triangle using an asterisk
*
**
***
****
9. Write a program in C to display the pattern like right angle triangle with a number
1
12
123
1234
10. Write a program in C to make such a pattern like right angle triangle with a number
which will repeat a number in a row.
1
22
333
4444
11. Write a program in C to make such a pattern like right angle triangle with number
increased by 1
1
23
456
7 8 9 10
6 Assignment (Functions and Jumping statements)
1. Write a program to print the 1D array (size 5) by initializing the array first?
2. Write a program to print the 1D array (size 5) from last element to first element?
3. Write a program to find sum of the array (size 5)?
4. Write a program to find average of the array (size 5)?
5. Write a program to enter 5 values into the array using for loop find the average of
the sum of the array?
6. Write a program to find an element in an array (size 10) and display its location or
index?
7. Write a program to find the middle element of an array (odd size 5 and even size
6)?
8. Write a program to find the elements in the odd locations of an array (size 8)?
9. Write a program to count number of zeros and number of ones in an bit array
B[8]={1,0,0,0,0,1,1,0}?
10. Write a program to return the average value of an array (size 5) using functions?
Hint: the function has no arguments and average value will be returned?
11. Write a program to sort the elements of an array: srt[7]={33,42,16,12,45,57,5} in
increasing and decreasing order and display both order?
8 Assignment (Array 2D/1D)
12 (Files)
1. Write a program to create a file, write in that file, and close the file?
2. Write a program to open a file, read the contents in that file (display it), and close
the file?