You are on page 1of 4

C programming

Assignment II (Decision Making and Branching)


1. Write a program in C to check whether the given number even or odd?
2. Write a program in C to check whether the given number positive, negative or zero?
3. Write a program in C to check whether the given year is leap or not?
4. Write a program in C to check whether the given character is an alphabet, a digit, a space character or a special
symbol? If the character is an alphabet then determine the case of the alphabet.
5. Write a program in C to change the case of an alphabet.
6. Write a program in C to find biggest and smallest of three given numbers?
7. Write a program in C to find biggest and smallest of three given numbers using && operator?
8. Write a program in C to display the name of the day in a week. Here given input range is 1 to 7.
9. Write a program in C to find whether a given character is vowel or not?
10. Write a program that will read the value of x and evaluate the value of y
, >0
= 0, = 0
, <0
11. Admission to CMSA is subject to the following conditions:
Marks in Mathematics >= 60%
Marks in Physics/ Computer Science >= 60%
Best marks in any four subjects >= 60%
Given the marks of a student,
Write a program that will process the application to declare whether the candidate eligible or not to take admission in
CMSA.
12. An electric power distribution company charges its domestic consumers as follows –
Consumption units Rate of charges
0 – 200 Rs. 0.50/unit
201 – 400 Rs. 100 + Rs. 0.65/unit excess of Rs. 200
401 – 600 Rs. 230 + Rs.0.80/unit excess of 400
601 and above Rs. 390 + Re. 1.00/unit excess of 600
Write a program in C that read the customer number and power consumed and print the amount to be paid by the
customer.
13. Consider the following two linear equations
+ + =0
+ + =0
Write a program in C to find the values of and .
14. Consider a quadratic equation of the following form –
+ + =0, 0
Write a program in C to find the roots of the quadratic equation.

Sukalyan Som 9830814843


C programming

15. Write a program in C to read three integer values from the keyboard and displays the output stating that they are
the sides of a right-angled triangle.
16. Write a program in C to check whether three points are collinear or not by taking the coordinates of the three
points from the user.
17. Write a program in C to determine the type of a triangle (side-wise) by taking the coordinates of the vertices
from the user.
18.Given the values of the variables x, y and z, WAP to rotate their values such that x has the value of y, y has the
value of z and z has the value of x.
19.Given an integer, WAP that displays the number as follows:
First Line: all digits
Second Line: all except first digits
Third Line: all except first two digits and so on.
20. Write a Menu driven Program to perform addition, subtract, and divide, multiply and modulo division between
two numbers.
21. Write a Program to check whether a character inserted is a vowel or not.
22. Write a Program which take the no of the day of any week as input and display the corresponding Day of the
week.

Sukalyan Som 9830814843


C programming

Assignment III (Decision Making and Looping)


1. Write a program in C to print natural numbers within the range m to n, to be given by the user. Also find the sum
and average of those numbers.
2. Write a program in C to display the even numbers and odd numbers between two given ranges?
3. Write a program in C to find = , is a non negative integer.
4. Write a program in C to display the leap years between a given ranges.
5. Write programs in C that prints the following shapes.

(Sequence and Series Calculation)


6. Write a program in C to find the value of the following series –
(i) 1+ + + + +

(ii) 1+ + + +
! ! !

(iii) 1 + + +( )
(iv) 1+( ) +( ) + +( )

(v) 1 + + + ( 1) =2 ,
! ! !

(vi) + + + ( 1) =2 + 1,
! ! !

7. Write a program in C to find the sum of the digits of a given integer. Also find the reverse of the integer.
8. Write a program in C to display Fibonacci numbers ( 1 1 2 3 5 8 13 21 … … ). Also print the prime Fibonacci
elements within a given range.
9. Write a program in C that will check whether a given number is prime number or not. Also generate Twin-primes
between a given range.

Sukalyan Som 9830814843


C programming

10.Write a program in C to display Armstrong numbers(1 + 5 + 3 = 153) within a given range.


11.Write a program in C which consider the following investment equation = (1 + ) where P is the principal
amount, V is the value of money at the end of n years and r being the rate of interest and then Calculate the V of
money and displays it for all the years given starting from first year.
12. A perfect number is a number whose factors excepting the number itself when added up given back the number.
Write a program to output all perfect numbers between ranges.
13. A famous conjecture, called “Gold batch” conjecture, says that every even integer n>2 has the property that it is
the sum of two prime numbers. Write a program that will prove the conjecture is true for all integers between given
ranges.
14. The value of e is given by the following infinite series
1 1 1
=1+ + + +
1! 2! 3!
Write a program in C that computes the value of e to an arbitrary precision.
15. A number is said to be a strong number which is equal to the sum of factorials of its digits. Write a program in C
that finds all such integers between given ranges.
16. Two positive numbers are said to be “buddy” if each one is equal to the sum of divisors of the other and divisors
include 1 but exclude the number itself. Write a program in C that generates all pair of buddies between given
ranges.
17. Write a program in C that reads a positive integer and generate all prime factors of it in ascending order.
18. Write a program in C that will read a positive integer and determine and print the binary equivalent of the
integer.
19. Consider an integer 12. It has the property that square of 12 is 144. Reverse of 12 is 21 whose square is 441
which is the reverse of square of 12. Write a program in C that will generate all such integers within a given range.
20. Write a menu driven program that reads a floating-point and then displays the right-most digit of the integral part
of the number and two right-most digits of the real part of the number.
21. Write a program that will generate all the Pythagorean triplets in a given range.
22. Write a program to express & check each element of the given sequence in the format

+ , + , + , ….

For example 12, 23, 34, 45, 56, 67, 78, 89 etc
23. Write a program for generating all possible combinations of a set of n variables.
24. Write a program to generate the following pattern upto N rows:
1
2 5
6 9 14
15 18 23 30
:

Sukalyan Som 9830814843

You might also like