## Basic Concepts of Percentage & Conversion Type Questions

To solve questions of format "What is x% of y?" every word or symbol in this sentence needs to be translated into math. “What” always represents a variable; let’s use x. The verb (is, was, are) always represents an equals sign. For any percentage, we write a fraction with the given number over 100. “Of” always represents multiplication.
Example
• Let’s solve the problem “What is 30% of 80?”
`Now, we can write: x = 30/100 * 80 and we do the math to solve for x. (The answer is 24.)`
Let’s try a slightly more complicated problem,
• x% of y is 50 and y% of 18 is 27. What is x?
Now we have multiple variables for our percentages. Can we still use our word translation method here? Sure!
`We have: x/100 * y = 50 and y/100 * 18 = 27`
Let’s solve the second equation first, since it has only one variable.
`We get y = 150 (remember – not 150 %!) so we plug y = 150 into the first equation and we get x = 33 and 1/3 (again, with no percentage sign).`
Next, we move on to Quick math on Percentages and converting among percents, fractions and decimals.
• Given 100% of a number, it is very easy to calculate 50%, 10%, 5% and 1% of that number. These four building blocks can then be used to calculate or estimate any whole-number percentage in a very short time. We’ll learn this method by example.
Let’s start with the number 120. First, we create a quick chart as follows:
120 = 100%
12 = 10%
1.2 = 1%
60 = 50%
6 = 5%
Now we can solve the problems using this base numbers.
Example 6% of 120 = 5% + 1% = 6 + 1.2 =7.2
One other type of calculation you must be adept is converting fractions, decimals to percents.
• Percent to Decimal: move the decimal point two places to the left. For example, 42% = 0.42.
• Percent to Fraction: place the percent number in the numerator and 100 in the denominator; simplify. For example, 42% = 42/100 = 21/50.
• Decimal to Percent: move decimal point two places to the right, For example, 1.6 = 160%.
• Fraction to Percent: first convert fraction to decimal, then follow the directions to convert from decimal to percent. For example, 5/6 = 0.833 repeating = 83 and 1/3 %.
Example, 0.54= 54% by moving two places which is nothing but 54/100
45% = 0.45 which is nothing but 45/100.
Remember the following to reduce your calculation speed.
1/2 = 50%
1/3 = 33.33%
1/4 = 25%
1/5 = 20% ; 2/5 = 2 x (20%) = 40% and so on…
1/6 = 16.66%
1/7 = 14.28%
1/8 = 12.5%
1/9 = 11.11%
1/11 = 9.09% and their multiples.

## Percent Change Type of Questions

Percent increase or decrease is one way to represent a change in a given number. (Note that, here, we are talking about a single change. Multiple changes will be covered below in the Continuous percentage change section) Percent increase is the percentage that the original number increases and percent decrease is the percentage that the original number decreases.
We can use a very simple formula for either type of problem:
`Increase (or Decrease) = (Change / Original) * 100`
Let’s try it out.
Example
• You’ve had your eye on a \$100 Trouser at the store, but you think it’s too expensive. Finally, it goes on sale for \$60. What is the percent decrease?
`The is always the difference between our starting and ending points. In this case, it’s 100 – 60 = 40. The “original” is our starting point; in this case, it’s 100. (40/100)*100 = (0.4)*100 = 40%.`
Always remember that your denominator is the original number or your starting point. The most common mistake made on this type of problem is using the smaller number for percent decrease or the larger number for percent increase.

This is actually exactly the opposite of what you want to do! Percent decrease means you’re going from a larger number to a smaller one, so the larger number is your starting point. And percent increase, of course, means you’re going from a smaller number to a larger one, so the smaller number is your starting point.

Always think of the denominator as your starting point number and you won’t get mixed up.

Let’s try another one.
Example
• Kelvin makes \$60 a week from his job. He earns a raise and now makes \$70 a week. What is the percent increase?
Increase = (10/60)*100 = (1/6)*100 = 16.66%.
Point to Remember
If there is 1/x fractional increase then you will have 1/(x+1) fractional decrease and vice versa.
• Example: If price of an article is increased by 33.33%, by what % it need to be decreased to make it to the same price?
Increased by 33.33% means 1/3 so need to reduce by 1/(3+1)= ¼ =25%.

## Multiple Percent Change Type of Questions

What about when we have multiple percentage changes happening in one problem?

These are called successive percentage change problems and our process is almost exactly the same.
• Two years ago, the population of a street in Los Angles was 250. Last year, the population increased by 20% and this year the population is expected to increase another 10% in that street. How many residents is that street of Los Angles expected to have at the end of this year?
The key to successive change problems is that you must do each step separately. You cannot just add the percentages together; if you do, you will always get it wrong!
Let’s look at the right way and the wrong way to do this problem.
• First, the right way: Street of Los Angles starts out with a population of 250. In the first year, the population increases by 20%, so we add 50 people (practice Fast Math here: 10% + 10% = 20%, so 25 + 25 = 50). Our new population is 250 + 50 = 300. This year, Los Angles will add 10% but, this time, 10% is based on the new population figure of 300, not the old figure 250. This year, we add 30 people, so our population at the end of the year is expected to be 300 + 30 = 330.
• Now, the wrong way: If we just add 20% and 10%, for an increase of 30%, we would have said that our population is based on a 30% increase of the 250 figure, or 75 (10% + 10% + 10% = 25 + 25 + 25 = 75). Our final answer would be 325. You can expect this number to show up in the answer choices, so you would not realize it if you made this mistake.
The reason we must do each step separately in a successive change problem is that the starting point for each step is a different number – it’s based on the number you just calculated in the preceding step. Just remember that you must do these problems step-by-step to get them right. You will never get it right if you just add or subtract the percents and do the math all at once.

## Important Formulas for Percentage Calculation

Formulas for Percentage of Population
If the current population is P and it increases at a rate of R% per annum, then
• Population after n years = P*(1 + R/100)n
• Population n years ago = P/(1 + R/100)n

Formulas for Percentage Increase/Decrease
• If the price of an object increases by R% , the reduction in consumption so as not to increase the expenditure = [R/(100 + R)] * 100 %
• If the price of an object decreases by R% , then the increase in consumption so as not to decrease the expenditure is = [R/(100 - R)] * 100 %

Formulas for Depreciation
If the current value of a car is P and it depreciates at a rate of R% per annum, then
• Value of car after n years = P*(1 - R/100)n
• Value of car n years ago = P/(1 - R/100)n

### C Questions

C Questions
C Questions

Note : All the programs are tested under Turbo C/C++ compilers.
It is assumed that,
Programs run under DOS environment, The underlying machine is an x86 system, Program is compiled using Turbo C/C++ compiler.
The program output may depend on the information based on this assumptions (for example sizeof(int) == 2 may be assumed).
Predict the output or error(s) for the following:

void main()
{
int const * p=5; printf("%d",++(*p));
}
Compiler error: Cannot modify a constant value.
Explanation:
p is a pointer to a "constant integer". But we tried to change the value of the "constant integer".
main()
{
char s[ ]="man"; int i;
for(i=0;s[ i ];i++)
printf("\n%c%c%c%c",s[ i ],*(s+i),*(i+s),i[s]);
}
aaaa nnnn
Explanation

### Zoho Interview | Set 1 (Advanced Programming Round)

Third Round: (Advanced Programming Round) Here they asked us to create a “Railway reservation system” and gave us 4 modules. The modules were:
1. Booking
2. Availability checking
3. Cancellation
4. Prepare chart
We were asked to create the modules for representing each data first and to continue with the implementation phase.

My Solution :