Hello, I m New In C Programing And I m Using "Turbo C 3.0" For Writing Programs. I Have Written A Program Which Source Code Is Below. The Program's Logic Is That, That It Takes Information Of 3 Students And I Had Used "Structure Array" In It. And I want that After Taking Marks Of Students It Will Print Percentage Which I Had Done But i Want "Grades" As Well To Be Print. My Source Is Below I Had Tried But On "grade=='A'","grade=='B'","grade=='C'", It Accours An error "Code Has No effect". Please Help Me Out And Paste Correct Source Code In answer Thanks!
Code:#include<stdio.h> #include<string.h> struct students { char n[30]; int m; int p; int u; int e; }std[3]; void main() { int i=0; float per; char grade; clrscr(); for(i=0;i<3;i++) { printf("\t\t:: Enter Information Of Student %d ::", i+1); printf("\nName: "); scanf("%s", std[i].n); printf("\nMaths: "); scanf("%d", &std[i].m); printf("\nPhysics: "); scanf("%d", &std[i].p); printf("\nUrdu: "); scanf("%d", &std[i].u); printf("\nEnglish: "); scanf("%d", &std[i].e); } printf("\n\t\t::.Percentage Of Students.::"); for(i=0;i<3;i++) { per=(std[i].m+std[i].p+std[i].u+std[i].e)*100/400; printf("\nPercentage Of %s Is %.2f%", std[i].n, per); } printf("\n\n::.Grades Of Students.::"); if(per>=70.00) { grade=='A'; } if(per>=60.00) { grade=='B'; } if(per>=50.00) { grade=='C'; } for(i=0;i<3;i++) { printf("\nGrade Of %s Is %c",std[i].n, grade); } getch(); }



LinkBack URL
About LinkBacks




... I Didn't Understood Second Point
Please Help Me Out!!