Click here to Skip to main content
11,495,371 members (64,446 online)

jahanxb asked:

Open original thread
hello frndz , i got a problem in my code whenever i excute my code it dont show the obtained marks result whats the problem in it .. here is the code

#include<stdio.h>
#include<conio.h>

void main ()
 
{
 

float physics,obt,a,b,d,e,f,g,c,maths,computer,english,urdu,pakstudies;
float total,avg,percentage;
clrscr();
printf("	\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
printf("	\nkindly enter your total marks and obtained marks of each subject");
printf("	\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
printf("	\nEnter total marks of physics:");
scanf("%f",&physics);
printf("	\nEnter obtained marks in physics:");
scanf("\n\t %f",&a);
c=(a/physics)*100;
printf("%.3f",c);
if(c<40)
{printf("\n u R fail in physics:(");
getch();
clrscr();
}
else if(c>=40)
{
printf("\n u R pass in physics:)");
getch();
clrscr();
}
printf("	\nEnter total marks of maths:");
scanf("%f",&maths);
printf("	\nEnter obtained marks of maths:");
scanf("%f",&b);
c=(b/maths)*100;
printf("\n\t %.3f",c);
if(c<40)
{
printf("\nu R fail in maths:(");
getch();
clrscr();
}
else if(c>=40)
{
printf("\n u R pass in maths:)");
getch();
clrscr();
}
printf("	\nEnter total marks of computer:");
scanf("%f",&computer);
printf("	\nEnter obtained marks of computer:");
scanf("\n\t %f",&d);
 
c=(d/computer)*100;
printf("\n\t %.3f",c);
if(c<40)
{
printf("\n u R fail in computer:( ");
getch();
clrscr();
}
else if(c>=40)
{
printf("\n u R pass in computer:)");
getch();
clrscr();
}
 

printf("	\nEnter total marks of english:");
scanf("%f",&english);
printf("	\nEnter obtained marks of english:");
scanf("%f",&e);
c=(e/english)*100;
printf("\n\t %.3f",c);
if(c<40)
{
printf("\nu R fail in english:( ");
getch();
clrscr();
}
else if(c>=40)
{
printf("\n u R pass in english:) ");
getch();
clrscr();
}
printf("	\nEnter the marks of urdu:");
scanf("%f",&urdu);
printf("	\nEnter obtained marks of urdu:");
scanf("%f",&f);
c=(f/urdu)*100;
printf("\n\t %.3f",c);
if(c<40)
{
printf("\n u R fail in urdu:( ");
getch();
clrscr();
}
else if(c>=40)
{
printf("u R pass in urdu:) ");
getch();
clrscr();
}
 
printf("	\nenter the marks of pakstudies:");
scanf("%f",&pakstudies);
printf("	\nEnter obtained marks of pakstudies:");
scanf("%f",&g);
c=(g/pakstudies)*100;
printf("\n\t %.3f",c);
if(c<40)
{
printf("	\nu R fail in pakstudies:( ");
getch();
clrscr();
}
else if(c>=40)
{
printf("	\nu R pass in pakstudies:) ");
getch();
clrscr();
}
total=physics+maths+computer+english+urdu+pakstudies;
obt=a+b+d+e+f+g;
avg=obt/6;
 

printf("Average of marks is : %.3f",avg);
percentage=(obt*100)/total;
printf("	\nPercentage of marks is : %.2f",percentage);
if(percentage>=90)
{
printf("	\n::::::::::::::::::::::::::::::::::::::::");
printf("	\n\tyour grade is:A");
printf("	\n\tcongratulations:) you scored A grade in your exams");
printf("	\n=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-==-=");
}
else if(percentage>=80)
{printf("	\n---------------------------------------");
printf("	\n\tYOur grade is:B");
printf("	\n\tYou have passsed the exams");
printf("	\n---------------------------------------");
}
else if(percentage>=70)
{printf("	\n---------------------------------------------------------");
printf("	\n\tyour grade is:C");
printf("	\n\tYou have passed the exams");
printf("	\n--------------------------------------------------------");
} else if(percentage>=60)
{
printf("	\n-----------------------------------------------------------");
printf("	\n\tYour grade is:D");
printf("	\n\tYou have passed the exams");
printf("	\n------------------------------------------------------------");
}
else if(percentage<60)
{
printf("	\n----------------------------------------------------------------------------------------");
printf("	\n\tYour grade is:F");
printf("	\n\tI Am sorry but you are fail");
printf("	\n----------------------------------------------------------------------------------------");
}
 

printf("	\n******************************");
printf("\ntotal MArks \t OBtained marks");
printf("\n %.1f",physics,"\t %.1f",a);
printf("\n %.1f",maths,"\t %.1f", b);
printf("\n %.1f",computer,"\t %.1f",d);
printf("\n %.1f",english,"\t %.1f",e);
printf("\n %.1f",urdu,"\t %.1f",f);
printf("\n %.1f",pakstudies,g);
printf("	\n**************************");
getch();
}
Tags: C, Windows

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the The Code Project Open License (CPOL).



Advertise | Privacy | Mobile
Web01 | 2.8.150520.1 | Last Updated 26 Mar 2009
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100