Lab 7 Q2

2 views
Skip to first unread message

TALHA THE great

unread,
Dec 27, 2011, 1:35:38 PM12/27/11
to Learn C Language
#include<stdio.h>
#include<conio.h>
int main (void)
{
int s,d,f,g,h,y,j,k,o;
clrscr();
printf("Enter your marks : ");
scanf("%d",&s);
for(d=86;d<=100;d++){
if(s==d){
printf("\nYour grade is A");
}
}
for(f=76;f<=85;f++){
if(s==f){
printf("\nYour grade is A-");
}
}
for(g=66;g<=75;g++){
if(s==g){
printf("\nYour grade is B+");
}
}
for(h=56;h<=65;h++){
if(s==h){
printf("\nYour grade is B");
}
}
for(y=46;y<=55;y++){
if(s==y){
printf("\nYour grade is B-");
}
}
for(j=36;j<=45;j++){
if(s==j){
printf("\nYour grade is C+");
}
}
for(k=31;k<=35;k++){
if(s==k){
printf("\nYour grade is C-");
}
}
for(o=0;o<=30;o++){
if(s==o){
printf("\nYour grade is F");
}
}
getch();
return 0;

}

AHSAN YASIN

unread,
Dec 29, 2011, 1:56:23 AM12/29/11
to Learn C Language
ur program is good but its not using the user define function
> }- Hide quoted text -
>
> - Show quoted text -

abhi gupta

unread,
Dec 30, 2011, 7:09:27 PM12/30/11
to Learn C Language
which user definde function u r saying about..

AHSAN YASIN

unread,
Jan 1, 2012, 4:03:00 AM1/1/12
to Learn C Language

ur personal identification is not clear however I'm answering ur
question

the user defined function " char finalgrade(int marks) "
was supposed to be used as clearly mentioned in lab task7 (bold Text)
so go to the class website and see "which user defined function I'm
saying about"
Reply all
Reply to author
Forward
0 new messages