Skip to content

Instantly share code, notes, and snippets.

@echo-akash
Created August 10, 2017 17:20
Show Gist options
  • Save echo-akash/dbd9aa31530bcf1f5ceffc1d8b05a288 to your computer and use it in GitHub Desktop.
Save echo-akash/dbd9aa31530bcf1f5ceffc1d8b05a288 to your computer and use it in GitHub Desktop.
Print the mark sheet of the students.
#include<stdio.h>
int main()
{
float n,a[100];
int i;
printf("enter the number of students:");
scanf("%f",&n);
printf("enter the marks of students:");
for(i=0;i<n;i++)
{
scanf("%f",&a[i]);
}
for(i=0;i<n;i++)
{
if(a[i]>=90)
{
printf("\nstudent %d got A+",i+1);
}
else if(a[i]<90 && a[i]>=80)
{
printf("\nstudent %d got A",i+1);
}
else if(a[i]<80 && a[i]>=70)
{
printf("\nstudent %d got A-",i+1);
}
else if(a[i]<70 && a[i]>=60)
{
printf("\nstudent %d got B",i+1);
}
else if(a[i]<60 && a[i]>=50)
{
printf("\nstudent %d got C",i+1);
}
else if(a[i]<50 && a[i]>=40)
{
printf("\nstudent %d got D",i+1);
}
else
printf("\nstudent %d got F",i+1);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment