You are on page 1of 61

Dear Students.

I am sending u all the first lot


Assignment".Submission dateof basic_questions_of_C "as a LAB-
is 10th November,2017.
Last lotwould
which of advanced_questions_in_C
be 20th November,2017.would be sent later on, and deadline of
On subject line do write : BTECH-17-C-Assignment.
Forward this mail to others.........
=========================================================
Write a program in C :
1. While purchasing certain items, a discount of 10% is offered if the quantity purchased is
more than 1000. If quantity and price per item are input through the keyboard, write a program
to calculate the total expenses.
2. If his basic salary is less than Rs. 1500, then HRA=10% of basic salary and DA=25% of basic.
If his salary is either equal to or above Rs. 1500, then HRA=Rs. 500 and DA=50% of basic. If the
employees salary is input through the keyboard write a program to find his gross salary.
3. The marks obtained by a student in 5 different subjects are input through the keyboard. The
student gets a division as per the following rules:
Percentage above or equal to 75 Honors
Percentage above or equal to 60 First Division
Percentage between 50 and 59 Second Division
Percentage between 40 and 49 Third Division
Percentage less than 40 Fail
Write a program to calculate the division obtained by the student.
4. If a number 972 is entered through the keyboard, your program should print Nine Seven
Two. Write a program such that it does this for any positive integer.
5. Write a program that, for all positive integers i, j, k, and l from 1 through 500, finds and
prints all possible combinations of i , j, k and l such that i+j+k=l and i<j<k<l.
6. A positive integer is entered through the keyboard. Along with it the base of the numbering
system in which you want to convert this number is entered. Write a program to display the
number entered, the base, and the converted number. For example, if the input is 64 2 then the
output should be 64 2 1000000. Similarly, if the input is 64 16, then the output should be 64 16
40.
7. Any character is entered through the keyboard, write a program to determine whether the
character entered is a capital letter, a small case letter, a digit or a special symbol. The
following table shows the range of ASCII values for various characters.

8. Write a program to find the factorial value of any number entered through the keyboard.
9. Two numbers are entered through the keyboard. Write a program to find the value of one
number raised to power of another.
10. Write a program to print all the ASCII values and their equivalent characters using a while
loop. The ASCII values vary from 0 to 255.
11. Write a program to print out all Armstrong numbers between 1 to 500. If sum of cubes of
each digit of the number is equal to the number itself, then the number is called an Armstrong
number. For example, 153 = (1*1*1) + (5*5*5) + (3*3*3).
12. Write a program to enter the numbers till the user wants and at the end it should display the
count of positive, negative and zeros entered.
13. Write a program to receive an integer and find its octal, hexadecimal and binary equivalent.
14. Write a program to generate all combinations of 1, 2 and 3 using for loop.
15. Write a program to print all prime numbers from 1 to 300. (Hint: Use nested loops, break
and continue).
16. Write a program to print the multiplication table of the number entered by the user.
17. Write a program to check whether number entered through keyboard is palindrome or not.
18. Write a program to print Fibonacci Series from 1 to 100.
19. Write a program to compute and display the sum of all integers that are divisible by 6 but
not divisible by 4 and lie between 0 to 100. The program should also count and display the
numbers of such values.
20. Write a program to compute the real roots of a quadratic equation
ax2 +bx +c =0
The roots are given by the equations
x1= -b + (sqrt(b2-4ac)/2a)
x2= -b - (sqrt(b2-4ac)/2a)
The program should request for the values of the constants a, b and c and print the values of
x1 and x2. Use the following rules:
(a) No solution, if both a and b are zero
(b) There is only one root, if a=0 (x=-c/b)
(c) There are no real roots, if b2-4ac is negative
(d) Otherwise, there are two real roots
Test your program with appropriate data so that all logical paths are working as per your design.
Incorporate appropriate output message.
21. Given a number, write a program using while loop to reverse the digits of the number. For
example, the number 12345 should be written as 54321. Also find the sum of all digits, even
digits and odd digits.
22. An electric power distribution company charges its domestic consumers as follows:
Computation Units Rate of Charge
0-200 Rs. 0.50 per unit
201-400 Rs. 100 plus Rs. 0.65 per unit excess of 200
401-600 Rs. 230 plus Rs. 0.80 per unit excess of 400
601 and above Rs. 390 plus Rs. 1.00 per unit excess of 600
The program reads the customer number and power consumed and prints the amount to be paid
by the customer.
23. Write a program to input ten numbers from keyboard and find the sum of all even numbers
and odd numbers.
24. Write a program to find HCF (Highest Common Factors) of two numbers.
25. Write a program to compute the value of Eulers number e, that is used as the base of
natural logarithms. Use the following formula.
e = 1 + 1/1! + 1/2! + 1/3! + 1/4! + + 1/n!
Use a suitable loop construct. The loop must terminate when the difference between two
successive values of e is less than 0.00001.

You might also like