![subject](/tpl/images/cats/informatica.png)
Computers and Technology, 12.12.2020 17:10 samueldfhung
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
![ansver](/tpl/images/cats/User.png)
Answers: 3
![](/tpl/images/ask_question.png)
![](/tpl/images/ask_question_mob.png)
Another question on Computers and Technology
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 24.06.2019 12:00
What is a sketch or blueprint of a web page that shows the structure (but not the detailed design) of basic page elements such as the logo, navigation, content, and footer?
Answers: 3
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 24.06.2019 18:00
Which of the following is an example of synchronous communication? a) e-mail b) voicemail c) telephone conversation d) text message.
Answers: 1
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 25.06.2019 01:00
Why is outfitting a workplace with video games in a technology development company consiered a strategic use of money
Answers: 1
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 25.06.2019 08:00
Implement a document scanning function wordcountengine, which receives a string document and returns a list of all unique words in it and their number of occurrences, sorted by the number of occurrences in a descending order. if two or more words have the same count, they should be sorted according to their order in the original sentence. assume that all letters are in english alphabet. you function should be case-insensitive, so for instance, the words “perfect” and “perfect” should be considered the same word.
Answers: 1
You know the right answer?
Hello, i am actually begginer in C language so need some help about it. I am making a program in whi...
Questions
![question](/tpl/images/cats/mat.png)
Mathematics, 16.02.2021 22:00
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/biologiya.png)
Biology, 16.02.2021 22:00
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/istoriya.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 16.02.2021 22:00
![question](/tpl/images/cats/istoriya.png)
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/istoriya.png)
History, 16.02.2021 22:00
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/istoriya.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 16.02.2021 22:00
![question](/tpl/images/cats/mat.png)
Mathematics, 16.02.2021 22:00
![question](/tpl/images/cats/mat.png)
Mathematics, 16.02.2021 22:00
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/biologiya.png)
![question](/tpl/images/cats/mkx.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 16.02.2021 22:00