The document outlines a programming assignment consisting of ten tasks related to basic C programming concepts. Tasks include finding the greatest number, checking student marks, determining even or odd numbers, validating triangles, and calculating electricity bills. Each task requires specific conditions and outputs based on user input.
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
2 views
Assignment 9
The document outlines a programming assignment consisting of ten tasks related to basic C programming concepts. Tasks include finding the greatest number, checking student marks, determining even or odd numbers, validating triangles, and calculating electricity bills. Each task requires specific conditions and outputs based on user input.
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3
ASSIGNMENT -9 (BASICS OF C PROGRAMMING)
1. WAP to find the greatest among the two given numbers.
Also, check whether the greatest number is between 500- 1000 or not. If yes, then print the value of entered number. 2. Write a program to take marks of 5 subjects from the user. Assume marks are given out of 100 and passing marks is 33. Now display whether the candidate passed the examination or failed. Print student’s total marks only if the student has passed the examination, otherwise not. 3. WAP to check whether a number is even or odd. If the number is even then check whether number is divisible by 3 and also by 2 or not. If the number is odd then check whether the number is divisible by 5 or not. Display messages accordingly. 4. Write a program to check whether a given number is positive, negative or zero. If the number is positive, check the number is divisible by 10 or not. 5. Write a program to check whether a year is a leap year or not. 6. WAP to check whether a triangle is valid or not if sides are given.
7. Write a c program to check whether a triangle is Equilateral,
Isosceles or Scalene. 8. Write a program to swap values of two int variables without using third variable. For example if a=5 and b=10, then output should be: a= 10 and b=5. 9. Write a program to print digits of one’s place and tenth’s place of a given number [For example, number is 2345, then digit at one’s place is 5 and digit at 10th place is 4]. Now check whether the digits at both place are equal or not. 10. Write a c program to input electricity unit charges and calculate total electricity bill according to the given condition: For first 50 units Rs. 0.50/unit For next 100 units Rs. 0.75/unit For next 100 units Rs.1.20/unit For unit above 250 Rs. 1.50/unit An additional surcharge of 20% is added to the bill.