0% found this document useful (0 votes)
42 views

C Programming Practical 4

Uploaded by

dhanshree1278
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)
42 views

C Programming Practical 4

Uploaded by

dhanshree1278
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/ 2

‭Course Code : 23ADS1101‬ ‭Course Name: C.

Programming Lab‬

‭Name of Students: Dhanshree Gaur‬ ‭Semester/ Section: 1st semester‬

‭Roll No: M-05‬ ‭Enroll No: 24070403‬

‭Problem Definition:‬‭‬

‭Write a straight line program for finding out the grades obtained by a student‬

‭Source Code in C:‬

‭#include <stdio.h>‬

‭int main() {‬

‭int percentage;‬

‭printf("Enter the Percentage : ");‬

‭scanf("%d", &percentage);‬

‭if (percentage >= 95){‬

‭printf("Grade : A+");‬

‭}‬

‭else if (percentage >= 90){‬

‭printf("Grade : A");‬

‭}‬

‭else if (percentage >= 80){‬

‭printf("Grade : B");‬

‭}‬

‭else if (percentage >= 70){‬

‭printf("Grade : C");‬

‭}‬
‭else if(percentage >= 60){‬

‭printf("Grade : D");‬

‭}‬

‭else‬

‭{‬

‭printf("Grades : E\n");‬

‭printf("FAIL");‬

‭}‬

‭return 0;‬

‭}‬

‭Output :‬

‭Conclusion:‬

I‭ n this practical we learnt about the use of if-else operator to obtain the desired result, i.e;‬
‭grades of the students based on their percentage.‬

You might also like