This program is a C program that calculates the total marks and average of five subjects and determines the grade based on the total marks and whether the student passed or failed.
#include<stdio.h> void marks(); int main() { marks(); return 0; } void marks() { int tam,eng,mat,sci,soc,tot,avg; printf("\nEnter the Marks:"); scanf("%d%d%d%d%d",&tam,&eng,&mat,&sci,&soc); tot=tam+eng+mat+sci+soc; avg=tot/5; printf("\nTotal Marks:%d",tot); printf("\nAverage:%d",avg); if(tot>230) { if(tot>=480) { printf("\nGrade:A"); } else if(tot>400&&tot<480) { printf("\nGrade:B"); } else if(tot<400) { printf("\nGrade:C"); } printf("\nPass"); } else { printf("\nFail"); } }To download raw file Click Here
Enter the Marks:99 87 96 95 96 Total Marks:473 Average:94 Grade:B Pass
This program is about print the marks with return value and with argument using functions.
#include<stdio.h> int marklist(int,int,int,int,int); int main() { int tam,eng,mat,sci,soc,tot,avg,ans; printf("\nEnter the Marks:"); scanf("%d%d%d%d%d",&tam,&eng,&mat,&sci,&soc); ans=marklist(tam,eng,mat,sci,soc); printf("\nTotal:%d",ans); avg=ans/5; printf("\nAverage:%d",avg); return 0; } int marklist(int tam,int eng,int mat,int sci,int soc) { int tot; tot=tam+eng+mat+sci+soc; return tot; }To download raw file Click Here
Enter the Marks:98 96 95 97 99 Total Marks:485 Average:97
This program is about print the marks no return value and with argument using functions.
#include<stdio.h> void marklist(int,int,int,int,int); int main() { int tam,eng,mat,sci,soc,avg; printf("\nEnter the Marks:"); scanf("%d%d%d%d%d",&tam,&eng,&mat,&sci,&soc); marklist(tam,eng,mat,sci,soc); return 0; } void marklist(int tam,int eng,int mat,int sci,int soc) { int avg,tot; tot=tam+eng+mat+sci+soc; printf("\nTotal marks:%d",tot); avg=tot/5; printf("\nAverage mark:%d",avg); if(tot>250) { printf("\nPass"); } else { printf("\nFail"); } }To download raw file Click Here
Enter the Marks:98 96 95 97 99 Total Marks:485 Average:97 Pass
This program is about print the marks with return value and without argument using functions.
include<stdio.h> int marklist(); int main() { int avg,total; total=marklist(); printf("\nTotal marks:%d",total); avg=total/5; printf("\nAverage:%d",avg); return 0; } int marklist() { int tam,eng,mat,sci,soc,tot,avg,ans; printf("\nEnter the Marks:"); scanf("%d%d%d%d%d",&tam,&eng,&mat,&sci,&soc); tot=tam+eng+mat+sci+soc; return tot; }To download raw file Click Here
Enter the Marks:98 96 95 97 99 Total Marks:485 Average:97
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions