

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
A c program that takes the name, id number, and marks of a student in five subjects as input and calculates their percentage. The program then checks whether the student has passed or failed based on the passing criteria of having marks above 35 in all subjects. The program also determines and displays the student's highest mark. This document could be useful for computer science students learning c programming and data structures.
What you will learn
Typology: Exercises
1 / 3
This page cannot be seen from the preview
Don't miss anything!
#include<stdio.h> #include<stdlib.h> #include<conio.h> struct result { char name[10]; int id; int marks[5]; float p; }; main() { struct result s1,p1; int i,total=0,max,n; p1=&s1; int pf(struct result); int large(struct result*); printf("Enter the name:"); scanf("%s",p1->name); printf("\nEnter the Id_no:"); scanf("%d",&p1->id); printf("\nEnter marks of 5 subjects:");
for(i=0;i<5;i++) { printf("\nMarks of sub %d:",i+1); scanf("%d",&p1->marks[i]); total=total+p1->marks[i]; } p1->p=(total)/5; printf("\nPercantage=%f",p1->p); n=pf(p1); if(n==1) { printf("\nStudent is pass."); } else { printf("\nStudent is fail."); } max=large(p1); printf("\nHighest marks is=%d",max); }
int pf(struct result *p1) { if((p1->marks[0]>35) && (p1->marks[1]>35) && (p1->marks[2]>35) && (p1>marks[3]>35) && (p1->marks[4]>35)) { return 1; }