New to programming - Lack math skills
Hello,
I just finished my first programming class and find myself lacking any programming skill. I obviously need to take a math class, but for now would like to learn as much as possible till next semester.
I have started to create a program that will calculate the users income in comparison to the world.
I want it to return a percent.
In this case the user income is above 33700 so they are in the top 5 percent. However, I would like to factor in the remaining 6300.
Any and all help would be greatly appreciated.
For now I just am doing the program for one income , but once I understand the math part I will create the rest of the program.
Here is what I have done
Code:
#include <stdio.h>
#define TOP_INCOME 100
#define TOP_TIER 80
#define TOP_TEN 25400
#define TOP_FIVE 33700
#define TOP_ONE 47500
int main ()
{
//Would scan right here
//lets say scan returned 40,000
int userIncome=40000;
int overBottomOfTier=0;
if (userIncome>=TOP_FIVE && userIncome<TOP_ONE)
{
overBottomOfTier=userIncome-TOP_FIVE;
printf("your income is %d\n\n", userIncome);
printf("You are %d over the bottom of top five percent\n\n", overBottomOfTier );
}
return 0;
}
So in this case I would need 95% + 6300$ = a percentage
Thanks again for the help.