Program:
/* To enter student number, name, marks in C, C++ and java. Calculate and display total marks, result and grade. */
#include<stdio.h>
#inlcude<conio.h>
void main()
{
int sno, c, cpp, java, tot;
char sname[20], res[5], div[10];
float avg;
clrscr();
printf("Enter Student Number : ");
scanf("%d", &sno);
printf("Enter Student Name : ");
fflush(stdin);
gets(sname);
prinrf("Enter marks in C : ");
scanf("%d", &c);
printf("Enter marks in CPP : ");
scanf("%d", &cpp);
printf("Enter marks in Java : ");
scanf("%d", &java);
tot = c + cpp + java;
avg = (float)tot/3;
printf("\nStudent Number is : %d", sno);
printf("\nStudent Name is : %s", sname);
printf("\nMarks in C is : %d", c);
printf("\nMarks in CPP is : %d", cpp);
printf("\nMarks in Java is : %d", java);
printf("\nTotal Marks is : %d", tot);
printf("\nAverage Marks is : %f", avg);
if(c>=35 && cpp>=35 && java>=35)
{
printf("\n Result : PASS");
if(avg>=60)
printf("\nDivision : FIRST");
else
printf("\nDivision : SECOND");
}
else
{
printf("\nResult : FAIL");
printf("\nDivision : NO DIVISION");
}
getch();
}
Output:
Enter Student Number : 224
Enter student Name : Tirupathi
Enter Marks in C : 75
Enter Marks in CPP : 80
Enter Marks in Java : 50
Student Number is :224
Student Name is : Tirupathi
Marks in C is : 75
Marks in CPP is : 80
Marks in Java is : 50
Total Marks is : 205
Average Marks is : 68.333336
Result : PASS
Division : First
Next Topic :
Previous Topic :
No comments:
Post a Comment