0% found this document useful (0 votes)
7 views1 page

Experiment 4

Uploaded by

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

Experiment 4

Uploaded by

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

Experiment 4

Title: Arithmetic and Relational Operators in C


1. Arithmetic Operations: Write a C program to input two integers from the user and
perform the following operations:
 Addition, subtraction, multiplication, division, and modulus.
 Check if the first number is greater than, less than, or equal to the
second number using relational operators. Display the results of each
operation.
2. Grade Calculation :Write a C program that performs the following tasks:
 Input the marks of a student in three subjects (out of 100) from the user.
 Calculate the total marks and the average marks using arithmetic operators.
 Use relational operators and if-else conditions to determine the grade as per
the following rules:
1. If the average is 90 or above, print "Grade: A."
2. If the average is between 75 and 89, print "Grade: B."
3. If the average is between 50 and 74, print "Grade: C."
4. Otherwise, print "Grade: Fail."
3. Leap Year Check :Write a C program that performs the following:
 Input a year from the user.
 Use arithmetic and relational operators to check if the year is a leap year. A
year is a leap year if:
1. It is divisible by 4 and not divisible by 100, or
2. It is divisible by 400.
 Use if-else to display the appropriate message:
3. If the year is a leap year, print "The year [year] is a leap year."
4. Otherwise, print "The year [year] is not a leap year."

You might also like