C Assignments


Sequence

  • Write a Program to read 2 numbers and perform arithmetic operations (Addition, Subtraction, Multiplication, and
    Division).
  • Develop a Billing application for a Departmental store, the application reads names and prices of 5 products and provides 10% discount on total bill. Customer bill should print Actual bill amount, Discount amount, final bill after discount and average net price of each product after discount.
     Note:

    1. The price of first 3 products should be declared as int and rest 2 products price should be as float.
    2.  Read all the inputs in single scanf().

 output:

bill

  • A Computer Manufacturing company announces a special offer to their customers on purchasing Laptops and
    Printers accordingly.
    On Laptops: Discount 15%
    On Printers: Discount 10%
    Write a program to read the price of laptop and Printer, Print Discount and the Final amount of Each Product and final amount.

output:

  • AH Production Releases movie duration in minutes, write a simple application to convert the movie duration in hours.
    output:
    Enter the duration of the movie(in minutes) : 250
    The Movie will play for 4 hours and 10 mins….
  • A university wants to develop an application which reads students rollno, first name, gender and 3 subjects marks(choose subjects as per ur choice) and prints total and average.

Note: All the 3 subjects and total variables should be declared as int type and average variable should be declared as float type.

output:
marks

 

Decision Making Control statements

  1. Write a program to read the price of two pens Parker and Pilot and display which is the costliest one.
  2. A Cloth showroom has announced the following festival discounts and the assured gifts on the purchase of items, based on the total cost of the items purchased:

    Total Cost Discount Assured Gift
    Less than or up to 2000/- 5% Wall Clock
    2000/- to 5000/- 10% School Bag
    5001/- to 10,000/- 15% Electric Iron
    More than 10,000/- 20% Wrist Watch

    Write a program to input the total cost of the item purchased then calculate the discount, amount to be paid after availing discount and the assured gift.

  3. Write a program to read name and time in 24 hours format. Then display appropriate greeting according to the time given.
    • Display error message for hours input more than 24.
    • Time before 12 hrs then print -Name, Good Morning.
    • Time in between 12 Hrs to 15 Hrs then print – Name, Good Afternoon
    • Time after 15 hrs then print – Name, Good Evening.
  4. Write a program to read Gender and Name of a person and display Greetings as below.
    • if gender is m/M then print Welcome Mr.______ to AH CAREER
    • if gender is f/F then print Welcome Miss.______ to AH CAREER
    • other than m/f simply print Welcome _________to AH CAREER
  5. Write a program to read an input from the user and check whether the inputted data is uppercase letter or lowercase letter or digit or special symbol.
  6. Write a program to read a no in between 0 to 9 and display in words using switch-case.
    • ex: if the number input is 8 then print “You have entered EIGHT”
  7. Write a program to read a number and print whether it is even or odd using ternary operator.
  8. Write a program to read 3 numbers and print them in ascending order(implement nested if).

 

Looping Control statements 

  1. Write a program to print Sum and Average of inputted N numbers.(Use While Loop)
  2.  Write a program to print inputted Name Length many times.(Use for Loop)
  3. Write a program to read numbers till the user enters 0, and print How many even and odd numbers from the inputted numbers.(do…While Loop)
  4. Write a program to check whether the given no is palindrome or not.(Use While Loop)
    note: if u reverse a no and if it is same as an original no then it is the palindrome.
    ex: 1221, 2332, 121
  5. Write a Program to PrintTable for any inputted NO.(Use For Loop)
    • Read Starting value and Ending value from the user.
  6. Write a program to print result for the given base and power.(Use While Loop)
  7. Write a program to print factorial of given no.(Use While Loop)
  8. Write a program to print Armstrong numbers below 1000.(Use While Loop)
  9. Write a program to print Prime numbers till N.(Use For Loop)
    Note:  N is the target value given at runtime.
  10. Write a program to check whether the inputted PinCode is valid or not.(Use While Loop)
       Note: valid mobile no should have 6 digits.
  11.  Write a program to find lucky from given from inputted date of birth.(Use While Loop)
    Note: For 14 th may 1990 input should be 14051990.
  12. Write a program to Print 2nd biggest no from the inputted N numbers.(Use For Loop)
  13. Write a program to read characters from the user till the user enters X or X, and display the total number of Capital letters, Small letters, Digits, Symbol, Vowels, and consonants.

Arrays:

  1. Write a program to enter values in Array of N elements and display them in reverse order.
  2. Write a program to Fill the array with 10 numbers and display them in ascending order.
    • use rand() function to generate numbers.
  3. Write declare two arrays for one for item codes and the other for item price. read 10 item codes and their prices. Calculate total cost and average cost and display.
  4. Write a program fill the array of N elements with random numbers, display even no’s and odd numbers separately with their index numbers.
  5. Write a program fill the array of N elements with prime numbers and display them along with their index numbers.
  6. Write a program to store values in two arrays and add values of both arrays into 3rd array.
  7. Write a program to store 10 numbers then print occurrence of each number.

Strings:

  1. Write a program to enter two passwords. Then find their lengths if both have same length then check their similarity.
  2. Write a program to check strength of password according to following rule.
    • for any lowercase,uppercase,digit,special symbol and length>8 assign 1 mark each
    • then calculate strength on 1-5 scale (1=weak , 2=fair, 3=good, 4=strong, 5=strongest)
    Password Strength Answer Reason
    abcd 1 Weak only lowercase letters
    abcdefghijk 2 Fair lowercase+length>8
    Ab$d5f 4 Strong uppercase+lowercase+symbol+digit
    @bcDef123 5 Strongest symbol+lower+upper+digit+length>8
    123456789 2 Fair digit+length>8
    abc@123 3 Good lowercase+symbol+digit
  3. Write a program to check given string is palindrome or not.
  4. Write a program to convert given sentence into proper case
    • Ex:- aim high career -> Aim High Career
  5. Write a program to combine given two strings into third string
  6. Write a program to convert full form of a name into acronym (short form)
    • Ex:- central processing unit -> CPU
  7. Write a program to store 10 names and print lengths of each name
  8. Write a program to store 10 names and print largest name (having more no of chars)
  9. Write a program to store a string then print that string without any vowels.
    • Ex: rajamahendravaram -> rjmhndrvrm
  10. Write a program to store a paragraph with text of 5 lines. then count no. or chars, no. of words, no. of vowels in that paragraph.

Functions and Pointers:

 

Structures and files: