BASIC PROGRAMMING QUESTIONS
1. Write the program for print a number series from 1 to 10.
2. Write the program which takes two numbers from the user as input and then SUM, SUBTRACT and
MULTIPLE them.
3. Write the program of print Half Pyramid of star including 5 rows with FOR command.
4. Write the program for printing the following:
1
12
123
1234
5. What is the output of the following :
For (int a=1; a<5 ; a++)
{
For (int b=a; b<5; b++)
printf(“%d”,b);
printf(“\n”);
}
6. Write a program which takes input for the year of birth and the current year. Calculate the age and print
it.
7. Write a C program which ask the user to input an integer and program displays its Square and Cube.
8. Write a program take input for the year of birth and the current year. Calculate the age and print it.
9. Write the coding of a program which ask user to input the radius of a circle, and program display the
area of a circle and its circumference.
10. Write a program that takes five subjects (Math, Physics, English, Urdu, Computer) marks and calculate
the total marks and percentage..
11. Write the coding of a C language program which take input of three integers and identify which one is
the smallest and which one is the greatest?
12. Write the coding of a C language program to print the following:
*
**
***
****
*****
13. Write a program, take input for basic salary, house rent allowance, travel allowance and medical
allowance calculate 5% tax on gross pay and calculate the net salary and print result. & also remove
errors from it
14. Write a program to solve the following a mathematical equation
K=a2 -2ab+b2
15. Write a program take input for the year of birth the current year. Calculate the age of the person and
print result.
16. Write a program which display the table of the N number
17. Write a program which can identify an even or odd number.
18. Take input for three numbers and find the greatest among them
19. Take input for two numbers X and y, Compare the numbers by if() and print the message whether these
are equal or not.
20. Write a program which take input of a positive number and find its square or cube according to the
choice of the user.
21. Write C-program equivalent statement of the following expressions:
i. 𝒂𝟐 + 𝟐𝒂𝒃 + 𝒃𝟐
(𝒙+𝒚)𝟑
ii.
(𝒙−𝒚)𝟐
iii. √𝒃𝟐 − 𝟒𝒂𝒄