Sunday, July 12, 2009

Can some one check foolowing c program and tell me whtat was the mistake i have done?

i try to make a program to enter makers of 5 subject and dispaly the five subject and calculate the gard. but for out put i get the subject mark and for thr grade every subjct i get 'f' , that is not changing if i enter i any number.can some one check it for me.


#include%26lt;stdio.h%26gt;


#include%26lt;conio.h%26gt;


#define n 5


char grading(int mark);








void main(void)


{


int mark,c,garde;


int sub[n];


clrscr();


for(c=0;c%26lt;n;c++)


{


printf("\nENTER MARKE FOR SUBJECT %d :",c+1);


scanf("%d",%26amp;sub[c]);


}


for(c=0;c%26lt;n;c++)


{


printf("\nmark for the subject%d is : %d",c+1,sub[c]);


grading(mark);


}


// grading (mark);


}


char grading(int mark)


{


char grade;


if ((mark%26gt;=0)%26amp;%26amp;(mark%26lt;=100));


if(mark%26lt;=60)


printf("f");





else


{


if(mark%26lt;=75)


printf("p");


else


{


if(mark%26lt;=100)


printf("d");


}


}


return(grade);


}

Can some one check foolowing c program and tell me whtat was the mistake i have done?
Judging by your grammar I would say you mistake is probably grammatical. That's without looking at your code.





Please have some common courtesy to spell check your posts!
Reply:Easy.


printf("\nmark for the subject%d is : %d",c+1,sub[c]);


grading(mark);





The variable mark is never assigned a value.


No comments:

Post a Comment