C Programming Assignment PDF
C Programming Assignment PDF
C PROGRAMMING
1. Write a program to find the largest number between two numbers using
Ternary operator.
2. Write a program, which take two values, and print their sum.
3. Write a program, which take two values, and print their Multiplication.
4. Write a program, which take two values, and print their sum of their square.
5. Write a program, which take three values, and print Max. Value (use Ternary
Operator)
6. Write a program to convert kilogram into Grams.
7. Write a program to convert inches into centimeters.
8. Write a program that accept Basic salary of employee and compute the bonus
@20% of Basic. Print Bonus and gross salary too.
9. Write a program, which accept length and breadth of a rectangle and print
the Area and perimeter of it.
10. Write a program, which accept the arm of triangle and print the Area and
perimeter of it.
11. Write a program to read following numbers from your keyboard, round them
to their nearest integer and print the result in integer format.
37.5 50.123 -25.5649 -56.8877 123.0
12. Write a program that accept sale price and cost price and find the profit and
loss.
13. Write a program to accept a four digit number and print the sum of first and
last digit and product of mid digits.
14. Write a program to accept the time in 24 hour format and print message
according to time. Like(good morning ,good evening, good afternoon, good
night)
15. Write a program to accept a number <10 print its in word , e.g.
1=>.One,2=>Two
16. Write a program to accept a character and convert it Upper case to Lower
case and lower to upper.
17. Write a program to accept a character from user and process it like this:
a. If character is alphabets then print next successive character e.g. a then b, x
then y, z then a.
b. If it is not alphabets then print that character as is:
18. Write a program to accept the basic salary of an Employee and
Calculate the gross and Net pay as per following rules.
Basic HRA DA CA PF
4500 to 6000 @12% @33% @15% @9%
6001 to 7000 @15% @33% @18% @9%
7001 to 8000 @17% @33% @20% @9%
8001 to 10000 @20% @33% @25% @9%
22. Write a program, which will accept the no of units of calls made and print the
amount payable, using following condition. First 200 calls are Free.
23. Write a program, which will accept the amount and compute the net amount
for the purchase made. The program must calculate the discount given on
these purchase and display the net customer has to pay. The Discount rates
are follows:
Amount Discount
>800 25%
24. Write a program, to compute the wage of labor (working on the daily basis) as
Loops
1. Write a program to print the following series :
a) 1,2,3,4,5,6 ----------------------------------up to N
b) 1,4,9,16,25----------------------------------up to N
c) 0,2,6,12,20----------------------------------up to N
d) 0,1,1,2,3,5,8,13---------------------------- up to N
e) 1,8,27,64------------------------------------up to N
f) 1,2,4,7,11,16------------------------------- up to N
2. Write a program to print ASCII value of a given character.
3. Write a program to print table of a given number.
4. Write a program to print the sum of even position & product of odd position
digit of any inputted Number.
5. Accept a Number from user and find reverse of it.
6. Accept a Number from user and check whether it is Prime or Not.
7. Accept a Number from user and check whether it is Palindrome or Not.
8. Accept a Number from user and check whether it is Armstrong or Not.
9. Write a program to print all Odd numbers from 1 to N terms 10. Write a
program to print all Even numbers from 1 to N terms
11. Write a program to find Factorial of a given number.
12. Write a program to print the sum of digit of any inputted Number.
13. Write a program to print the product of digit of any inputted Number.
14. Write a program to calculate total no of digit in a given number.
15. Accept a Number from user and check whether it is Perfect No. or Not.
(A perfect number is a number which factor‟s sum is equals to Number e.g
6 (3+2+1))
16. Accept a Number from user and print its equivalent Binary Number.
17. Accept a Number and Base from user and print its equivalent Base Number.
18. Print the table form n1 to n2 (n1(starting point) and n2(ending point) )
19. Write a program to print all factors of a given Number.
20. Write a program to print all prime number form 1 to 100
21. Write a program to print all Armstrong number form 1 to 100
22. Write a program to print all Perfect number form 1 to 100
23. Write a program to accept a number and print it in Words. E.g 125 as One
Two Five.
24. Write a program to print the following Triangle up to n terms:
*
**
***
25. Write a program to print the following Triangle up to n terms:
***
**
*
26. Write a program to print the following Triangle up to n terms:
*
***
*****
27. Write a Program to print the following triangle.
*****
***
**
*
28. Write a program to print the following Triangle
A
ABA
ABCBA
ABCDCBA
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1
121
12321
1234321
123454321
STRING
1. Write a program to input String using following functions and print it.
a) scanf() b) gets() c) at declaration time
2. Write a program to read a String and print its length (without using library
function)
3. Write a program to read a string and copy it into another string.(Do not use
Library Function) 4. Write a program to read two String and concatenate
it.(without using library function)
5. Write a program to print given string in reverse order.
6. Write a program to read a string and a character. After that print the final
string by replacing all vowel characters of the string with given character.
7. Write a program to count the following in a given sentence.
[A] Upper case character [B] Lower case character
B1
[A] 3
N 2
9. Write a program to remove all extra spaces in a given String.
10. Write a program to sort given string in ascending order.
11. Write a program to sort given string in descending order.
12. Write a program to find the No. of Characters with space and without space in
a given String.
13. Write a Program that read Name of Person and print it in following Format.
If User Input “
Sabab Ali Khan” then it Print :
[A] S.A.K. [B] S.A.Khan [C] Khan S.A.
FUNCTION
1. Write a Function that take 2 numbers and return smaller Value.
2. W.A.F. that take 2 numbers and return larger Value.
3. Write a recursive Function for calculate Factorial of a received Number. And
return to the calling function.
4. Write a recursive Function for Binary search.
5. W.A.F. that takes an integer type array of size 10 and return the greatest
number.
6. W.A.F. that takes an integer type array of size 10 and return the smallest
number.
7. W.A.F. that takes an integer type array of size 10 and return Sum of All
numbers.
8. W.A.F. that takes an integer type array of size 10 and return Sum of All Even
numbers.
9. W.A.F. that takes an integer type array of size 10 and return Sum of All ODD
numbers.
10. W.A.F. that takes an integer type array of size 10 and return Sum of All Even
position‟s numbers.
11. W.A.F. that takes an integer type array of size 10 and return Sum of All ODD
position‟s numbers.
POINTER
1. Write a Function that receive the base address of integer type array and print
their values using Pointer.
2. Write a Program that receive a String and print it in reverse Form using
Pointer.
3. Write a Function that receive the base address of integer type array and print
greatest value using Pointer.
4. Write a Function that receive the base address of integer type array and print
Smallest Value using Pointer.
5. Write a Function that receive the Last Block address of integer type array and
print their values using Pointer in Reverse Order.
6. Write a Function that receive the base address of integer type array and print
Sum of All values using Pointer.
FILE HANDLING
1. Write a program to display content of file on screen. File name given by user
2. Write a program to display content of Specified file on screen in the following
way.
[A] Upper Case [B] Lower Case [C] Title or Proper Case
3. Write a program to Create and display content of file on screen. File name
given by user
4. Write a program to display No. of Line, Space, Non- Alphabet, Alphabet of
file on screen. File name given by user.
5. Write a program that accept two file names first as a Source and second as
destination then copy first file content in second file.
6. Write a program to Combine two file content into Third file.
7. Write a program to Combine two file content into third file. And also add Line
Number at beginning of each line.
8. Write a program to print 1 to 100 and redirect output in a file.
9. Write a program that accept two file names first as a Source and second as
destination then copy first file content in second file in reverse Order.
10. Write a program to find out the size of given file.
11. Write a program to print Nth character of a file. Value of N is given by user.
Graphics Programming
1. Write a program to draw a line from upper left to center of the screen.
2. Write a program to draw the following in center of the screen with orange
color.
3. Write a program to draw the following… that animate from one point to another.
4. Write a program to draw the following 3-D ractangle…
5. Write a program that draw the following TEXT on Center of the screen that change color
of TEXT for each 2 second.