C Program to Check Student Division विद्यार्थी की Division ज्ञात करने का C Program

In C language, we can use the if-else if-else statement to check a student's division based on percentage of marks. This program checks whether a student has secured First, Second, or Third Division, or has failed. It also handles invalid percentages.

C भाषा में if-else if-else statement का उपयोग विद्यार्थी की percentage के आधार पर उसकी division ज्ञात करने के लिए किया जाता है। यह program First, Second, Third Division या Fail की जाँच करता है। साथ ही, यह invalid percentage को भी handle करता है।

C Program

#include <stdio.h>
int main(void)
{
float per;
printf("Enter Percentage of marks\n");
scanf("%f", &per);
if (per < 0 || per > 100)
printf("Invalid Percentage\n");
else if (per >= 60)
printf("First Division\n");
else if (per >= 45)
printf("Second Division\n");
else if (per >= 33)
printf("Third Division\n");
else
printf("Fail\n");
return 0;
}

Output

Example 1:

Enter Percentage of marks
75
First Division

Example 2:

Enter Percentage of marks
52
Second Division

Example 3:

Enter Percentage of marks
38
Third Division

Example 4:

Enter Percentage of marks
25
Fail

Example 5:

Enter Percentage of marks
105
Invalid Percentage

Explanation

  • per < 0 || per > 100 checks whether the percentage is invalid.

  • per >= 60 checks for First Division.

  • per >= 45 checks for Second Division.

  • per >= 33 checks for Third Division.

  • If none of these conditions is true, the program displays Fail.

यह program सबसे पहले जाँचता है कि percentage 0 से कम या 100 से अधिक तो नहीं है। यदि percentage invalid है, तो Invalid Percentage प्रदर्शित होता है। अन्यथा, विद्यार्थी की division जाँची जाती है।

Modern C Compatibility Note

This program uses standard C features and is compatible with modern C compilers such as GCC, Clang, and Visual Studio C.

Note: The division criteria used in this program are illustrative. Actual division criteria may vary according to the rules of the relevant board or institution.

This program demonstrates how to use if-else if-else statements to check student division and handle invalid percentage values in C.

यह program C भाषा में if-else if-else statement का उपयोग करके विद्यार्थी की division तथा invalid percentage की जाँच करना सिखाता है।

Comments

Popular posts from this blog

C Language Topics in Hindi and English

Complete C Programming Syllabus | Advanced C Roadmap for Students

Top High-Paying Tech Skills to Learn in 2025