0% found this document useful (0 votes)
2 views3 pages

C Program for Grade Calculation

The document contains code for several C programs that take user input, perform calculations, and output results. The programs demonstrate concepts like declaring variables, taking user input, performing conditional checks and arithmetic operations, and printing output.

Uploaded by

brianmtira199
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views3 pages

C Program for Grade Calculation

The document contains code for several C programs that take user input, perform calculations, and output results. The programs demonstrate concepts like declaring variables, taking user input, performing conditional checks and arithmetic operations, and printing output.

Uploaded by

brianmtira199
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

#include <stdio.

h>
int main()
{
int n,a,b;
a=10;
b=20;
n=a>b?printf("a"):printf("b")
return 0;
}

#include <stdio.h>
int main()
{
int n,a,b;
printf("enter the one value");
scaf("%d",& a);
printf("enter the other value");
scaf("%d",& b);
n=a>b?printf("a"):printf("b");
return 0;
}

#include<stdio.h>
main()
{
int mins,hours,minutes,secs;
printf("Enter the time in minutes: ");
scanf("%d",&minutes);
hours=minutes/60;
mins=minutes%60;
printf("Hours in mins and seconds: %d hours %d mins\n",
hours, mins);
return 0;
}

PASSED AVG>=50
FAIL AVG<50
DECLARE VARIABLES
MATHS = 40
ENGLISH = 59
GEOGRAPHY =60
STEPS

IF AVG>=50
PASSED
IF AVG<50
FAILED
#include <stdio.h>
main()
{
int main maths, eng, geo, sum, ave;
math=40;
eng=59;
geo=60;
sum=maths+eng+geo;
ave=sum/3;
IF (ave>=50);
printf("PASSED");
IF (ave<50);
printf("FAILED")

#include<stdio.h>
main()
{
int mk1,mk2,mk3,total,avg;
printf("Enter marks for English: ");
scanf("%d",&mk1);
printf("Enter marks for Mathematics: ");
scanf("%d",&mk2);
printf("Enter marks for Geography: ");
scanf("%d",&mk3);
total=mk1+mk2+mk3;
avg=total/3;

printf("English Score: %d\n",mk1);


printf("Mathematics Score: %d\n",mk2);
printf("Geography Score: %d\n",mk3);
printf("The total marks: %d\n",total);
printf("The average marks: %d\n",avg);

if(avg>=50)
{
printf("You Passed well!!! Congratulations\n");
}
else
{
printf("You Failed terribly!!!! Need to rewind");
}
return 0:
}

You might also like