0% found this document useful (0 votes)
6 views8 pages

C Level 1 Qns

The document outlines a series of C programming tasks that cover various programming concepts such as number categorization, quadrant finding, electricity bill calculation, simple calculator operations, area calculations for different shapes, triangle classification, attendance percentage calculation, and more. Each task includes specific requirements, input/output examples, and conditions to be met. The tasks aim to enhance programming skills through practical applications in different scenarios.

Uploaded by

rnaninaidu659
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views8 pages

C Level 1 Qns

The document outlines a series of C programming tasks that cover various programming concepts such as number categorization, quadrant finding, electricity bill calculation, simple calculator operations, area calculations for different shapes, triangle classification, attendance percentage calculation, and more. Each task includes specific requirements, input/output examples, and conditions to be met. The tasks aim to enhance programming skills through practical applications in different scenarios.

Uploaded by

rnaninaidu659
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

1.

Number Categorizer

Write a C program that takes an integer as input and categorizes it based on


the following conditions:
● If the number is positive and a multiple of 5, print "Positive multiple of
5".
● If the number is positive but not a multiple of 5, print "Positive but not
a multiple of 5".
● If the number is negative and a multiple of 3, print "Negative multiple
of 3".
● If the number is negative but not a multiple of 3, print "Negative but
not a multiple of 3".
● If the number is zero, print "The number is zero".

2. Quadrant Finder

Write a C program that takes the x and y coordinates of a point as input and
determines which quadrant the point lies in.
● If the point lies on the x-axis or y-axis, print the corresponding axis.
● If the point lies at the origin, print "Origin".
● Otherwise, determine and print the quadrant:
○ Quadrant I: x > 0, y > 0
○ BCCQuadrant II: x < 0, y > 0
○ Quadrant III: x < 0, y < 0
○ Quadrant IV: x > 0, y < 0
Sample Input1:
3(x)
4(y)
Sample Output1:
Quadrant I

3. Electricity Bill Calculator

Write a C program that calculates the electricity bill based on the following
tariff:
● For the first 100 units: $0.50 per unit
● For the next 100 units: $0.75 per unit
● For the next 100 units: $1.20 per unit
● For units above 300: $1.50 per unit

Example Input/Output:

● Input: 50 Output: Total bill: $25.00


● Input: 150 Output: Total bill: $87.50
4.Simple Calculator with Switch

Write a C program that takes two integers and an operator (+, -, *, /) as input
and performs the corresponding operation using a switch statement. Handle
division by zero and invalid operators appropriately:
● If the operator is not one of the four valid operators (+, -, *, /), print "Invalid
operator".
● If there is an attempt to divide by zero, print "Division by zero is not Allowed".

Example Input/Output:

● Input: 5, 3, '+' Output: 8


● Input: 10, 0, '/' Output: Division by zero is not allowed.
● Input: 4, 2, '%' Output: Invalid operator.

5. Write a C program that takes a character ('C', 'S', 'R', 'T') representing a
shape (Circle, Square, Rectangle, Triangle) and corresponding dimensions
as input, then calculates and prints the area using a switch statement:

● 'C': Requires radius; Area = π * radius^2


● 'S': Requires side length; Area = side^2
● 'R': Requires length and width; Area = length * width
● 'T': Requires base and height; Area = 0.5 * base * height
● If the input is not 'C', 'S', 'R', or 'T', print "Invalid shape".

6.Write a C program that reads the lengths of three sides of a triangle from
the user and classifies the triangle based on the given lengths. The
program should first validate whether the input lengths can form a triangle.
A valid triangle satisfies the condition that the sum of any two sides must
be greater than the third side.

Once the triangle is validated, determine the type of triangle using the
following criteria:

1. If all three sides are equal, print "The triangle is Equilateral."


2. If exactly two sides are equal, print "The triangle is Isosceles."
3. If no sides are equal, print "The triangle is Scalene."

Example Input/Output:

● Input: 3 3 3 Output: The triangle is Equilateral.


● Input: 4 4 6 Output: The triangle is Isosceles.
● Input: 3 4 5 Output: The triangle is Scalene.
● Input: 1 2 3 Output: The given lengths do not form a valid triangle.

7.Write a program to find the students attendance percentage calculation.

Test Case 1:

Enter the student name: Millie Bobby


Enter the student roll number: 11
Enter the total number of working days: 90
Enter the total number of days the student is present: 81

Output :

Attendance percentage : 90%

Test Case 2:
Enter the student name: Jane Smith
Enter the student roll number: 33
Enter the total number of working days: 80
Enter the total number of days the student is present: 80

Output:
Attendance percentage: 100%

8.Vowel or Consonant Checker Write a C program that takes a single


character as input and checks if it is a vowel or a consonant. If the input is
not a letter, print "Invalid input".

Vowels: a, e, i, o, u (both uppercase and lowercase)

9. Write a C program that takes a year as input and checks if it is a leap


year

10.Write a C program that checks whether a given integer is divisible by


both 4 and 6, by only 4, or only 6, .

The program should display one of the following messages based on the
input:

"The number is divisible by both 4 and 6." – if the number is divisible by


both 4 and 6.
"The number is divisible by 4 but not by 6." – if the number is divisible by 4
but not by 6.
"The number is divisible by 6 but not by 4." – if the number is divisible by 6
but not by 4.

Sample Input 1:

Enter an integer: 24
Sample output:

The number is divisible by both 4 and 6.

11.Write a C program that takes an integer input from the user and prints
one of the following messages based on its divisibility:

●​ If the number is divisible by both 3 and 5, print "FizzBuzz".


●​ If the number is divisible by only 3, print "Fizz".
●​ If the number is divisible by only 5, print "Buzz".
●​ If the number is not divisible by either 3 or 5, print the number itself.

12. Season Determiner

Write a C program that takes an integer (1-12) representing a month and


prints the corresponding season using a switch statement:

●​ 12, 1, 2: Winter
●​ 3, 4, 5: Spring
●​ 6, 7, 8: Summer
●​ 9, 10, 11: Fall
●​ If the input is not in the range 1-12, print "Invalid month".

13.Write a C program that takes the total number of minutes as input from
the user and converts it into hours and remaining minutes. The program
should display the result in the format: X hour(s) and Y minute(s)

Example Input/Output:
Input: 135
Output: 2 hour(s) and 15 minute(s)

14.Write a program to identify the profit or loss based on cost price


and selling price.

If profit - print profit


If loss - print -(loss)
If neither - print no profit, no loss
Test Case 1:
Enter cost price: 20
Enter selling price: 25
Output :
Profit : 5
Test Case 2:
Enter cost price: 30

15)Write a C program that checks the speed of a vehicle and compares it


with
the speed limit.

The program should:

1. Take two inputs:


●​ The speed of the vehicle.
●​ The speed limit.
2. If the vehicle speed is greater than the speed limit, print "Warning:
Speeding!".
3. If the vehicle speed is equal to or less than the speed limit, print "OK:
Within Speed Limit"

16)A shopkeeper announces a festival discount on electronics. Write a


program to calculate the final price after applying the discount.

Input 1:
Price:1000
Discount:10

Output:
900

Input 2:
Price=3500
Discount=90

Output:
350
17. Grade Evaluator

Write a C program that takes a student's score as input and prints the
corresponding grade based on the following criteria:

● If the score is 90 or above, print "Grade: A".


● If the score is between 80 and 89, print "Grade: B".
● If the score is between 70 and 79, print "Grade: C".
● If the score is between 60 and 69, print "Grade: D".
● If the score is below 60, print "Grade: F".

18.The program should take a single character input and identify whether it
is:
●​ An Alphabet (a–z or A–Z)
●​ A Digit (0–9)
●​ A Special Character (anything else)

Input 1:
A
Output:
Alphabet
Input 2:
9
Output:
Digit
Input 3:
@
Output:
Special Character

19.Write a C program that takes an integer as input and checks whether it is


a Buzz Number.
A number is called a Buzz Number if:
It is divisible by 7 or
It ends with the digit 7

The program should print "Buzz Number" if the condition is met, otherwise print
"Not a Buzz Number".

Example Input/Output:

Input: 27 Output: Buzz Number


Input: 35 Output: Buzz Number
Input: 23 Output: Not a Buzz Number

20.Find the Greatest Among 3 numbers.

You might also like