Computers and Technology

Hello, i am actually begginer in C language so need some help about it. I am making a program in which i take 3 subjects and take input of that from User. After that i find percentage of each subject depend upon marks i enter and then i try to find Total percentage of 3 subject(Main Goal) but the total percentage i get is not right i am getting. I am putting everything right. I am entering 20 marks for each subject. so total 60 of all 3 subjects. Now my question is
1st: Kindly check the code and let me know why i am getting 46.6 something instead of 21.8 something percentage(Found using calculator)
#include

int main()
{
float ObtainedPhysicsNumber, ObtainedMathsNumber, ObtainedEnglishNumber;
int TotalPhysicsNumber, TotalMathsNumber, TotalEnglishNumber, TotalSubjectNumbers;
float PhysicsPercentage, MathsPercentage, EnglishPercentage, TotalPercentage;

printf("Your Physics Number is\n");
scanf("%f", &ObtainedPhysicsNumber);

printf("Your Maths Number is\n");
scanf("%f", &ObtainedMathsNumber);

printf("Your Urdu Number is\n");
scanf("%f", &ObtainedEnglishNumber);

// Subject Total Number
TotalPhysicsNumber = 100;
TotalMathsNumber = 100;
TotalEnglishNumber = 100;
// Total Subject numbers
TotalSubjectNumbers = TotalPhysicsNumber + TotalMathsNumber + TotalEnglishNumber;
printf("Total Subject Numbers is %d\n", TotalSubjectNumbers);
// Percentage of each subject

PhysicsPercentage = ObtainedPhysicsNumber / TotalPhysicsNumber * 100;
printf("Your Physics percentage is %f\n", PhysicsPercentage);

MathsPercentage = ObtainedMathsNumber / TotalMathsNumber * 100;
printf("Your Maths Percentage is %f\n", MathsPercentage);

EnglishPercentage = ObtainedEnglishNumber / TotalEnglishNumber * 100;
printf("Your Urdu Percentage is %f\n", EnglishPercentage);

//Calculating Total Percentage
TotalPercentage = ObtainedMathsNumber + ObtainedPhysicsNumber + ObtainedEnglishNumber / TotalSubjectNumbers * 100;
printf("Total Percentage is %f\n", TotalPercentage);

return 0;
}
Output i get is after entering Physics, Maths and Urdu number
Your Physics Number is
20
Your Maths Number is
20
Your Urdu Number is
20
Total Subject Numbers is 300
Total Percentage is 46.666668

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 20.06.2019 18:04, cowerdwhisper23
Arla made a spreadsheet in excel showing the projected costs for a concert she was putting on. what can marla enter into cell a11 to find out how much money is left in her budget and to make sure the cell is updated whenever she changes any of the other costs?
Answers: 1
image
Computers and Technology, 22.06.2019 10:00, fnaflover8505
Businesses allocate resources for their best and most productive uses. the more a resource, the more costly it will be. a manufacturer that requires scarce and costly resources is likely to charge for its products.
Answers: 2
image
Computers and Technology, 24.06.2019 07:40, daebreonnakelly
What type of multimedia are live news feeds? live news feeds are examples of multimedia.
Answers: 2
image
Computers and Technology, 24.06.2019 11:30, AnwarWeirdLol8811
Why is body language an important factor in a business meeting
Answers: 1
Do you know the correct answer?
Hello, i am actually begginer in C language so need some help about it. I am making a program in whi...

Questions in other subjects: