You are on page 1of 8

SEQUENTIAL CONTROL STRUCTURE PROGRAMS

------------------------------------
1. Write a program to swap two numbers with/ without taking third variab
le.
2. Write a program that computes the area of a square, Rectangle , trian
gle , circle .
3. Write a program to convert a given number of days to a measure
of time given in years, weeks, and days. for example, 375 days
equals 1 year, 1 week, and 3 days. (Ignore leap years in this
program.)
4. Input no.of seconds, convert them into minutes and hours.
eg. = 3600 seconds = 1hour
3654 seconds = 1 hour , 50 minutes , 4seconds
5. write a program that declares an integer variable called num,
assign a value to it and computes and prints out the values of the
variable itself, its square and its cube.
6. Write a program to convert temperature from celsius to Faherenhe
it.
7. Write a program to convert temperature from Faherenheit to celsi
us.

DECISIONS ( IF - ELSE)

1. Check whether given number is even or odd.


2. Check whether given number is positive or negative.

3. Find out the Largest among three numbers without using the
Logical operators.
4. Find out the largest among three numbers using the logical operator.

5. Calculate the bill, if total amount is more than 1000 then


give 10% discount else no discount.
6. Take the marks of five subejcts calculate the total and the
average and on the basis of average decide the grade of the student.
0 - 34 % Fail
35 - 45 % Third grade
46 - 60 % Second grade
61 - 75 % First grade
75 onwards Distinction.

7. Take the basic salary from the user if basic salary is less
than or equal to 2000 then DA=40% and HRA is 20%
if basic salary is greater than 2000 then DA=60% and HRA is 40%.
Calculate the gross salary.
8. Write a program to accept consumer no. consumer name,
previous meter reading,current meter reading,dues and calculate
the bill amount depending on the number of units.
Rates for different units are :-
Units Rate
0-100 2.25
101-500 5.65
501-1000 7.85
1001 onwards 9.30
9. Calculate the total wages of the month.
Take working hours from the user.
Working Hours Wages
Less than or equal to 200 2000
More than 200 100 Rs./hr. overtime.
10. Write a program to accept consumer no. consumer name,
previous meter reading,current meter reading,dues,category
and calculate number of units consumed and bill amount depending
on the number of units.
Rates are :-
Categories Rate per unit
A FOR Aggri. 2.25
D FOR Domestic 3.50
C FOR Commercial 4.75
I FOR Industrial 5.65
11. Write a program to accept student no., name, marks in maths, physics
and chemistry. Calculate total. Find out whether the student is eligibl
e
for professional course. To eligible for professional course the follow
ing
conditions are
1. marks in maths >= 60
2. marks in physics >= 50
3. marks in chemistry >= 40
4. total marks >=200 or maths+physics >= 150
12. A company is giving loan to the employees for every 6 months
according to the company rules.
1. An employee cannot enjoy more than two loans at any point of time.
2. Maximum permissible loan is limited 50,000.
The rules for sanctioning new loan are
1. Loan one should be zero.
2. Loan two + request loan should not be more than maximum loan.
13. Write a program to accept student no.,name and marks. Calculate
scholarship on school fees according to the following conditions.
marks scholarship
60 - 70 5%
71 - 84 35%
85 and above 75%
Bye the bye school fees is 5000
14. A commercial bank has introduced an incetive policy of giving bonus
to all its deposite holdes. The policy is as follows.
A bonus of 2% is given to every one, irespecitve of their balance, and
5% is given to female account holders if their balance is more
than 5000.
SWITCH - CASE
` 1. Take the number from the user upto 10 and print it in words.
eg. 1 = one , 2 = Two
2. Take the character from the user and print whether the
entered character is vowel or consonent. (Programme should be
applicable for both the cases i.e. Upper and Lower case);
3. Take two numbers from the user and show him the menu of the
operations to be performed on these two numbers and ask his
choice operate and display the result.
4. Take any four digit number from the user and print it in words.
(Programme should be applicable for all the numbers upto 9999).
6. Take the month number from the user and print the corresponding month.
7. Take the month number from the user and print the season occuring
in that month.
8. A cloth showroom has announced the following seasonal discounts on
purchase of items.
purchase amount discount
mill cloth handloom items
0 - 1000 -- 5%
1001 - 2000 5% 7.5%
2001 - 3000 7.5% 10%
3001 and above 10% 15%
WHILE / DO - WHILE / FOR

1. Print the sum of first 10 natural numbers.


2. Print the sum of first 10 even numbers.
3. Print the sum of first 10 odd numbers.
4. Print the n number of natural, odd and even numbers.
5. Print the sum of given n number of numbers.
6. Take the number from the user and printf the sum of the digits.
7. Print the multiplication table up to 10 of a given table number.
8. Print the average of given n number of numbers.
9. Take the number from the user and check whether the entered number
is prime or not.
10. Take the number from the user and check whether the entered number
is perfect or not.
11. Print the series first 100 prime numbers.
12. Print the floyd's triangle.
optput :-
1
2 3
4 5 6
7 8 9 10
.........91
13. Print this triangle.
output :-
1 * 1 1
0 1 * * 1 2 2 2
1 0 1 * * * 1 2 3 3 3 3
0 1 0 1 * * * * 1 2 3 4 4 4 4 4
1 0 1 0 1 * * * * * 1 2 3 4 5 5 5 5 5 5

14. Print the Fibonacci series.


15. Write a program, find out sum of digits of given number.
16. Take the number from the user and reverse it and check whether
whether it is same as the number.
17. Take the number from the user and check whether the given number
is an Armstrong number or not.
(Armstrong number is the number whose sum of the cube of digits
is equal to the number itself).
18. Print the series of Armstrong numbers upto 1000.
19. Take ten numbers from the user and print the largest among them.
20. Take the number from the user and convert it into it's
binary equivalent.
21. Take the number from the user and convert the number into
its roman equivalent.
22. Write a program to produce the following output.
1 2 3 4 5 6 7 8 9 10
2 4 6 8 10 12 14 16 18 20
3 .........................
4 .
5 .
6 .
7 .
8 .
9 .
10 20 30 40 50 60 70 80 90 100

STRINGS
1. Take two strings from the user and concatenate these two strings
using the inbuilt function.
2. Take two strings from the user and compare these two strings
whether they are equal or not using the inbuilt function.
3. Take a string from the user and print the reverse of the string
using the inbuilt function.
4. Take one string from the user and copy it into another string
variable and print the copied string.
4. Take one string from the user and check whewther the given string
is palindrome or not.
6. Take a string from the user and find out the length of the string.
7. Write a program to find out position of a given character in a
given string.
8. Write a program to find out the number of times repeated of a
given character in a given string.
9. Write a program to find out the no. of words in a given string.
10. Print the shortform of a given string.
Example : Rahul Computers Infotech
Output : RCI
11. Write a program to find out the position of a given string within a
given string.
Given text : Rahul Computers Infotech
Find text : Computers
Output : 7
12. Write a program to print the each word in a seperate line of given
string.
13. Write a program to produce a following output
A B C D E F G F E D C B A
A B C D E F F E D C B A
A B C D E E D C B A
A B C D D C B A
A B C C B A
A B B A
A A

ARRAYS
1. Take two numbers from the user and find the HCF of the numbers.
2. Find Highest number in an Array of 10 numbers.
3. Sort an Array of 10 numbers in assending / desending order.
4. Count the number of even / odd numbers in an Array.
5. Sort an Array of 10 names in assending / desending order.
6. Create an array of size 10, Accept 9 numbers and assign into 10th
cell sum of nine numbers and print the array.
7. Create an array of size 10, accept 10 numbers and find out maximum
and minimum number from an array.
8. Write a program to accept 11 players name,no.of runs,no. of wickets
and no. of catches. Calculate each player no. of points for runs, no. of
points for catches and total points. Find out the man of the match
player name who got maximum total points. The points are as follows
1. for every 25 runs 5 points.
2. for every wicket 4 points.
3. for every catch 3 points.
9. Write a program to accept the 10 students name,number,marks,average
and print in the following format
no. name m1 m2 m3 m4 total average
1 aaa 40 40 40 40 160 40

TWO DIMENSIONAL ARRAYS

1. Take two matrices of 3 x 3 order and add them and store in the
third matrix.
2. Take two matrices of 3 x 3 order and subtract them and store in the
third matrix.
3. Print the unit matrix of 8 x 8 order.
4. Take two matrices of 3 x 3 order and multiply them and store in the
third matrix.
5. Take one matrix of 3 x 3 order and print it in the ascending
order.
6. Take one matrix of any order and print the transpose of the
given matrix.
POINTER
1. Create a variable and assign it some value then print the value
address of that variable and the value at that address.
2. Take two numbers from the user and add them using the pointers
and print the result.
(Don't use name of variables even in scanf and printf statements
only use pointers.)
3. Take two numbers from the user and swap them using the pointers.
4. Take an array of 10 numbers and sort the array in ascending order
using the pointers.
(Use only pointers, don't use array name).
6. Take the string from the user and reverse that string with the
help of the pointers.
7. Take two strings from the user and concatenate these strings
using pointers.
8. Take two strings from the user and compare these strings whether
they are equal or not using pointers.
FUNCTIONS
1. Send the number into the function and print the Cube of a number
in the function itself.
2. Send the number into the function and print the Cube of a number
in the main function.
3. Send the radius of the circle in the function and print the area
area of that circle in the main function.
4. Take an array of 10 elements from the user and pass it in the
function and print square of every element in the main function.
5. Take two numbers from the user and swap them in the function and print
the swapped values in the function.

STRUCTURES :
1. Create the structure of a student and take all details and print
it on the screen.
2. Create the structure of an employee and take all details and print
it on the screen.
3. Create the structure of a book and take all details and print
it on the screen.
4. Demonstrate the functioning of the book shop.

FILE HANDLING
1. Create a file on the DOS using dos commnads and write few lines
in that file.
Read the file through a C program.
2. Create a file with the C program and read the contents with the
help of C program.
3. Create a file, write few lines in the file and the contents into
another file.
4. Generate a table of the given number and store it in the file
and read it with the help of C programme.
5. Take the input of name, age and roll of 5 students and store it
it in the file "STUD.DAT". Then print the contents of the file.
6. Create a structure of an employee containing name of employee,
id_number, and basic salary.
Store record of 5 employees and read it back on the screen.

*************************************
Ascii codes
*************************************
A - 65 Z - 90
a - 97 z - 122
0 - 48 9 - 57
Enter Key - 13
Space Bar - 32
Tab Key - 9
BackSpace - 8

You might also like