Sie sind auf Seite 1von 10

SET- 1 Simple C Programs..

1. Write a program to print “Hello World” on the screen.


2. Write a program to Program to read one number and display it. (With messages)
3. Write a program that will obtain the length and width of a rectangle from user and
calculate its area, perimeter and diagonal.
4. The straight line method of computing the yearly depreciation of the value of an
item is given by
Depreciation= (Purchase Price-Salvage Value)/ Years of Service. Write a program to
determine the salvage value of an Item when the purchase price, years of service and the
annual depreciation are given
5. Area of a triangle is given by the formula

A=sqrt(S(S-a)(S-b)(S-c))

Where a,b and c are sides of the triangle and 2S=a+b+c. Write a program to compute the
area of the triangle given the values of a,b and c
.
6. Write a program to Convert temperature in Celsius to Fahrenheit /
Fahrenheit to Celsius.
F= (9/5) *C + 32

7. Write a program to find the sum of the digits of a 3-digit integer constant.
8. Write a program to interchange the values of two variables.
9. Write a program to Assign value of one variable to another using post and pre
increment operator and print the results.
10. Write a program to Read the price of item in decimal form e.g. 12.50. Separate
rupees and paisa from the given value e.g. 12 rupees and 50 paisa.
SET 2 :Write a “C” program using if , if-
else ,switch.
1. Write a program to read marks from keyboard and your program should display
equivalent grade according to following table.
Marks Grade
100-80 Distinction
60-79 First class
35-59 Second class
0-34 Fail
2. Write a program for Solution of quadratic equation
3. Make Simple Calculator using switch and if …else if
4. Find maximum and minimum of three numbers using ternary operator.
5. Check if the given year is leap year or not. ( Use full condition
for leap year )
6. Convert the case of a given character ( i.e. upper to lower & vice
versa ) ( Use getchar & putchar )
7. Find maximum / minimum of 3 numbers using if and also using
the Ternary operator.
8. Write a program to find out Net salary, HRA, DA, PI of
employee according to Basic salary. Do using if and also using
switch statements.

Net salary=Basic+HRA+DA+PI

Basic salary HRA DA PI


>= 10,000 20% 15% 10%
>= 5,000 and < 10,000 15% 10% 5%
< 5000 10% 5% -

9. Write a program that will allow computer to be used as an


ordinary calculator. Consider only common arithmetic
operations.(+, -, *, / ) The program should display a menu
showing the different options available. Do using if and also
using switch statements.
10. The cost of one type of mobile service is Rs. 250 plus Rs. 1.25
for Each call made over and above 100 calls. Write a program to
read Customer codes and calls made and print the bill for each
customer.
SET 3:Write a “C” program Using for, while & do-while loop.

1. Write a program to Print 1st N natural numbers & calculate their sum
& avg.
2. Write a program to Print squares / cubes of 1st N natural numbers &
calculate their sum & avg.
3. Write a program to Print all numbers between -n & +n.
4. Write a program to Print 1st N odd / even numbers & calculate their
sum & avg.
5. Write a program to Print all numbers between given two numbers x &
y including x & y, & calculate their sum & avg.
6. Write a program to print all odd/even numbers between given two
Numbers x & y including x & y, & their sum & avg.
7. Write a program to print every third number beginning from 2 until
Number < 100, & calculate their sum & avg.
8. Write a program to print all numbers exactly divisible by 5 until
number < 100, & calculate their sum & avg. Use modulus operator to
check Divisibility.
9. Write a program to Print the following series: -15, -10, -5, 0, 5, 10, 15.
10. Write a program to Print the value of the following series : -1, x, -x2,
x3, -x4, .....
11. Write a program to Print the value of the following series : sinx,
sin2x,sin3x, sin4x,........sin nx.
12. Write a program to Print the multiplication table of given number X
until n, in the Following format: X x 1 = X
13. Write a program To calculate the power of a number i.e. xy or xn
without using pow() function
14. Write a program to Calculate the factorial of a number.
15. Write a program to Print all letters of the alphabet in upper & lower
case.
16. Write a program to Print all characters between given 2 numbers x &
y.
17. Write a program to Print 1st N numbers of the Fibonacci series.
18. Write a program to Check if the given number is prime or not.
19. Write a program for 1-x+x2/2!-x3/3! +x4/4!…xn/n! terms.
SET 4 : Write a “C ” program for following Pattern..

1
12
123
1234

1
22
333
4444

1
121
12321
1234321

GHIJ
DEF
BC
A

1
01
010
1010
SET 5 : Write a “C ” program Using an ARRAY….

1.Write a program to read N integers and print N integers Using an


array.
2.Write a program to find the smallest and largest number in an array of
N integers.
3.Write a program to arrange an array of N elements into ascending
order.
4.Write a program to read the marks of one subject of 20 students and
compute the number of students in categories FAIL, PASS, FIRST
CLASS and DISTINCTION.
5.Write a program to insert value at ith location or value entered by
user using one dimensional array.
6.Write a program to delete value at ith location or value entered by
user using one dimensional array.
7.Write a program to add two 3*3 matrices, if A and B both are 3*3
matrices then resultant matrix C=A+B where Cij=Aij+Bij using Two-
dimensional array.
8.Write a program to check whether given 3*3 matrix is magic square
or not.
Note : A square matrix is called magic square if the sum of its all
rows, columns and diagonal are equal.
SET – 6 Write the following programs for String Operation..

1) Write a program to read string from user and print the lenght of the
string

2) Write a Program to reverse a string

3) Write a program to check whether given string is palindrome string


or not

4) Write a program to read your name and ouput the ascii code of the
first character representing your name

5) Write a program to print each word of the given string into seperate
line

6) Write a program to count number of words in a given string

7) write a program to count number of occurence of a given character


in a given string.
SET - 7 Write the below program using functions..

1. Write a program to find number is odd or not.


2. Write a program to find out factorial of given number
using function.
3. Write a program to generate series x,x2,x3........xn
4. Write a program to find maximum of three numbers.
SET- 8 Write the below program using Structure..

1. Write a program to reads student roll number,student


name.student marks of
5 subjects and prints student information on screen.

2. Write a program which define a structure data type called


time_struct containing three members integer Hour, integer
Minute and integer Second.
Develop a program that would assign values to the individual
memebers and display the time in the folowwing form:
16:40:51

3. Write a program which define a structure that can describe a


hotel. It should have members that includes the name,
address, grade, average room charge and number of rooms.
The program should perform following operation
1) To print out hotels of a given grade in order of charges.
2) To print out hotels with room charges less then the given
value

4. Write a program to read student roll number,name and maths


marks for 3 students and prints student name and rollno if the
marks are equal on screen.
SET - 9 Write the below program using C Pointer…

1. Write a program to print the address of a different datatype


variables along with its value.
2. Write a program using pointer to read in a array of integers
and print its elements in reverse order
3. Write a program that compares two integer arrays to see
whether they are identical.
4. Write a program to sort the array in ascending/descending
order using pointers
SET- 10 Write the below program using C++ Language..

1. Write a program in C++ which read name, age of student using class
and display it.
2. Implement a C++ program using scope resolution operator.
(The program should declare three variable with same name, one
should be global and the rest two should be declared in two
different blocks.)
3. write a program in C++ to swap two varibles using function(call by
refernce.
4. Write a program in c++ to calculate the area of triangle using inline
function.
5. Write a program in c++ to calculate the volume of
cube,cylinder,rectangle using function overloading.
6. Write a program in c++ to calculate factorial using friend
function(Also use constructor).

Das könnte Ihnen auch gefallen