Friday

Chapter 3 - Financial Analysis

1. Dental Delights has two divisions. Division A has a profit of $200,000 on sales of $4,000,000. Division B is only able to make $30,000 on sales of $480,000. Based on the profit margins(Return on sales), which division is superior?

Solution

Division A
Return on Sales = (Net income/Sales)
= $200,000/ $4,000,000
=0.05

Return on sales=5%

Division B
Return on Sales = (Net income/Sales)
=  $30,000/ $480,000

Retuen on sales =6.25%

Division B is superior with higher Return on sales ratio.

2. Griffey Junior Wear Inc. has $800,000 in assets and $200,000 of debt. It reports net income of $100,000.
a. What is the return on assets?
b. What is the return on equity?

Solution

Return on assets = (Net income/Total assets)*100
=$100,000/$800,000
=0.125
=12.5%

Return on assets=12.5%

3. Bass Chemical Inc. is consideding expanding into a new product line. Assets to support this expansion will cost $1,200,000. Bass estimates that it can generate $2 million in annual sales, with a 5 percent profit margin. What would net income and return on assets. 

Solution
Net Income = ?
Return on assets = ?

To find the Return on assets we need net income first. So we will find net income first.

Sales = $2 million = $2,000,000    [1 million = 1,000,000]
Profit Margin = 5% or 0.05
Profit Margin = (Net Income/Sales)
So
0.05 = (Net Income/2,000,000)
Net Income = 2,000,000*0.05

Net Income=$100,000

Return on assets = (Net Income/Total assets)*100
=(100,000/1,200,000)
=0.083
=8.33%

Return on assets = 8.33%

4. Franklin Mint and Candy Shop can open a new store that will do an annual sales volume of $750,000. It will turn over its assets 2.5 times per year. The profit margin on sales will be 6 percent. What would net income and return on assets(investment) be for the year?

Solution

Profit Margin = (Net Income/ Sales)
0.06 = (Net Income/750,000)
Net Income = $45,000

Return on assets = (Net Income/Total assets)
=>2.5 = (750,000/Total Assets)
=>Total assets = 0.15

Total Assets = 15%

5. Hugh Snore Bedding, Inc., has assets of $400,000 and turns over its assets 1.5 times per year. Return on assets 12 percent. What is its profit margin(return on sales)?

Solution

Asset Turnover = (Sales/Total assets)

1.5 = Sales/400,000

Sales = $600,000

Return on assets = Net Income/Total assets

0.12 = Net Income/ $400,000

Net Income = $48,000

Profit Margin = (Net Income/Sales)

Profit Margin = $48,000/$600,000
=0.08

Profit Margin = 8%












For more information about the author Click Here!!!

Sunday

Chapter 2: The Decision Control Structure

[C] Attempt the following

a) if cost price and selling price of an item is input through the keyboard, write a program to determine whether the seller has made profit or incurred loss. Also determine how much profit or loss he made or loss he incurred.

Soluion
IDE: CodeBlock
#include <stdio.h>
#include <stdlib.h>

int main()
{
    float cost,price;
    printf("Enter Price:");
    scanf("%f",&price);
    printf("Enter Cost:");
    scanf("%f",&cost);
    if (cost>price)
    {
        printf("He has incurred loss of Rs.%f",cost-price);
    }
    else
    {
        printf("He has made profit of Rs.%f",price-cost);
    }
    getchar();
    return(0);
}

b) Any integer is input through keyboard. Write a program to find out whether it is an odd number or even number.

Solution
IDE: CodeBlock

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int odd_even;
    printf("Enter the number:");
    scanf("%d",&odd_even);
    if (odd_even%2==0) //if the number is divided by 2 and give remainder 0 then it is an even number.
    {
        printf("%d is an even number.",odd_even);
    }
    else
    {
        printf("%d is an odd number.",odd_even);
    }
    getchar();
    return 0;
}

f) If the ages of Ram,Shyam and Ajay are input through the keyboard, write a program to determine the youngest of the three.

Solution

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int ram_age,shyam_age,ajay_age;

    printf("Enter the age of Ram:");

    scanf("%d",&ram_age);

    printf("Enter the age of Shyam:");

    scanf("%d",&shyam_age);

    printf("Enter the age of Ajay:");

    scanf("%d",&ajay_age);

    if (ram_age<shyam_age && ram_age<ajay_age)
    {
        printf("Ram is the youngest.");

    }
    else if(shyam_age<ram_age && shyam_age<ajay_age)
    {
        printf("Shyam is the youngest.");
    }
    else if(ajay_age<ram_age && ajay_age<shyam_age)
    {
        printf("Ajay is the youngest.");
    }
    getchar();

    return 0;
}

g) Write a program to check whether a triangle is valid or not, when the three angles of the triangle are entered through the keyboard. A triangle is valid if the sum of all the three angle is equal to 180 degrees.

Solution

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a,b,c;
    printf("Enter the 1st angle:");
 
    scanf("%d",&a);
 
    printf("Enter the 2nd angle:");
 
    scanf("%d",&b);
 
    printf("Enter the 3rd angle:");
 
    scanf("%d",&c);
 
    if (a+b+c ==180)
    {
        printf("It is a valid triangle.");
    }
    else
    {
        printf("It is not a valid triangle.");
    }
    getchar();
 
    return 0;
}

i) Given the length and bbreadth of a rectangle, write a program to find whether the area of the rectangle is greater than its perimeter. For example, the area of the rectangle with length  = 5 and breadth = 5 is greater than its perimeter.

Solution
FORMULA
Area = Length* Height
Perimeter = 2(length+height)

IDE : CodeBlock

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int length,breadth,area,perimeter;

    printf("Enter the length:");

    scanf("%d",&length);

    printf("Enter the breadth:");

    scanf("%d",&breadth);

    area = length*breadth;

    perimeter = 2*(length+breadth);

    if (area>perimeter)
    {
        printf("Area is greater than perimeter.");
    }
    else if (area<perimeter)
    {
        printf("Area is less than perimeter.");
    }
    else if (area==perimeter)
    {
        printf("area is equal to perimeter.");
    }

    getchar();

    return 0;
}


Monday

Chapter 1: Getting Started

[H] Write C Programs for the following

(a) Ramesh's basic salary is input through the keyboard. His dearness allowance is 40% of basic salary, and house rent allowance is 20% of basic salary, write a program to calculate his gross salary?

ANS:
If the Salary of Ramesh is $100.
then his dearness allowance will be =  (100*40%) or Rs.40
then his rent allowance will be  =  (100*20%) or Rs.20
So his gross or total salary will be = 100+40+20
                                                 = Rs.160

Solution in C
Using codeblock IDE

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int salary,gross_salary;
    printf("Enter the basic salary=");
    scanf("%d",&salary);
    gross_salary = salary+(salary*0.20)+(salary*0.40);
    printf("The gross salary is =%d",gross_salary);
    return(0);

}

b) The distance between two cities (in Km) is input through the keybpard. Write a program to convert and print this distance in metres, feet,inches and centumeters.

ANS: As we know,
1km = 1000m
1km = 100000 cm
1km = 39370.1 inch
1km = 3280.84 feet

Solution in C
Using Code#block IDE

#include <stdio.h>
#include <stdlib.h>

int main()
{
    float km,inch,feet,centimeter,meter;
    printf("Enter the distance in Km:");
    scanf("%f",&km);
    meter = km*1000;
    printf("\nDistance in meter=%f",meter);
    feet = km*3280.84;
    printf("\nDistance in feet=%f",feet);
    inch = km*39370.1;
    printf("\nDistance in inch=%f",inch);
    centimeter = km*100000;
    printf("\nDistance in centimeter=%f",centimeter);
    return(0);
}

OR

#include <stdio.h>
#include <stdlib.h>

int main()
{
    float km,inch,feet,centimeter,meter;
    printf("Enter the distance in Km:");
    scanf("%f",&km);
    printf("\nDistance in meter=%f",km*1000);
    printf("\nDistance in feet=%f",km*3280.84);
    printf("\nDistance in inch=%f",km*39370.1);
    printf("\nDistance in centimeter=%f",km*100000);
    return(0);
}

Both will give you the same result.


(c) If the marks obtained by a student in five subjects are input through the keyboard,find out the aggregate marks obtained by a student. Assume that the maximum marks that cab ne obtained by a student in each subject is 100.

ANS:
Suppose
Mr. Paul result sheet is
English     : 80
Math        : 85
Biology    : 80
Chemistry: 90
Physics    : 85

So, He his total mark is  = 80+85+80+90+85 = 420 out of 500
So his Percentage is  = (420/500)*100 = 84%

Solution in C
Using Code#block IDE
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int sub1,sub2,sub3,sub4,sub5,total_mark,percentage;
    printf("Enter the mark of 1st subject out of 100:");
    scanf("%d",&sub1);
    printf("Enter the mark of 2nd subject out of 100:");
    scanf("%d",&sub2);
    printf("Enter the mark of 3rd subject out of 100:");
    scanf("%d",&sub3);
    printf("Enter the mark of 4th subject out of 100:");
    scanf("%d",&sub4);
    printf("Enter the mark of 5th subject out of 100:");
    scanf("%d",&sub5);
    total_mark = sub1+sub2+sub3+sub4+sub5;
    percentage = (total_mark*100)/500;
    printf("\nThe total marks obtained in 5 subejects is=%d",total_mark);
    printf("\nThe percentage is=%d %",percentage);
    return(0);

}

(c) Temperature of a city in Farenheit degree is input through the keyboard. Write a program to convert this temperature into Centigrade degrees.

ANS:
The formula is C = 5/9 (F-32)

Solution in C
Using Code#block IDE

#include <stdio.h>
#include <stdlib.h>

int main()
{
    float farenheit,centigrade;
    printf("Enter the Farenheit:");
    scanf("%f",&farenheit);
    centigrade = (farenheit-32)*0.5555556;
    printf("The Centigrade degree is:%f",centigrade);
    return(0);
}



(f) Two numbers are input through the keyboard into two location C and D. Write a program to interchange the contents of C and D.

ANS:
Inorder to exchange the number. First it is necessary to keep one number in a temporary varaiable here the value of C has been stored in a temporary variable. Then the value of D has been assigned in the value of C. As we have already stored the value of C in a variable named as "storing_temoporary_value" we will assign that value in the value of D. Now both the value has been exchanged.

Solution in C
Using Code::block IDE

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int c,d,storing_temorary_value;
    printf("Enter C:");
    scanf("%d",&c);
    printf("Enter D:");
    scanf("%d",&d);
    storing_temorary_value = c;
    c = d;
    d = storing_temorary_value;
    printf("C is now %d",c);
    printf("\nD is now %d",d);
    return(0);
}

(g) If a 5 digit number is input through the keyboard write a program to calculate the sum of its 5 digits.

ANS:
Inorder to do that we need to use modulus or "%" this sign to make it more simple.
what is it???
It is nothing not the remainder.
for say, if we divide 10/2 we will get = 0 remainder
if we divide 15/2 we will get 1.

Now if we divide the number by 10 using the modulus we will get the last digit only.
Then we will divide the number by 10 to reduce the number.
e.g. 12345%10; it will give us 5 That is the last digit of 12345. 
Now if we divide the number by 10 we will get 1234.
REMEMBER "Integer" always remove the remainder. So it will not consider the remainder. So we will follow the same steps again and again until we get the first digit.
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a,b,c,d,e,f,g,h,i,add;
    printf("Enter you 5 digit:");
    scanf("%d",&a);
    b = a%10;//5
    c = a/10;//1234
    d = c%10;//4
    e = c/10;//123
    f = e%10;//3
    g = e/10;//12
    h = g%10;//2
    i = g/10;//1

    add = b+d+f+h+i;
    printf("The total addition of digits is = %d",add);
    return(0);


(h) If a 5 digit number if input through a keyboard, write a program to reverse the number.

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a,b,c,d,e,f,g,h,i,j;
    printf("Enter you 5 digit:");
    scanf("%d",&a);
    b = a%10;//5
    c = a/10;//1234

    d = c%10;//4
    e = c/10;//123

    f = e%10;//3
    g = e/10;//12

    h = g%10;//2
    i = g/10;//1


    printf("The total addition of digits is = %d%d%d%d%d",b,d,f,h,i);
    return(0);

}

(i)  If a 4 digit number is input through the keyboard, write a program to obtain the sum of the first and last digit of this number.

Solution in C
Using Code::block IDE

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a,b,c,d,e,f,g,h,i;
    printf("Enter you 4 digit:");
    scanf("%d",&a);
    b = a%10;//5
    c = a/10;//1234

    d = c%10;//4
    e = c/10;//123

    f = e%10;//3
    g = e/10;//12

    h = g%10;//2
    i = b+h;

    printf("The sum of 1st and last digit is : %d",i);
    return(0);

}







Sunday

Let Us C: Chapter 1 Solution

Let Us C by YASHAVANT P. KANETKARChapter 1: Getting Started (PAGE:39)

Exercise

[A] Which of the following are invalid variable names and why?
BASICSALARY
1)_basic      
OK          
2)basic-hra
WRONG
No special symbol other than undersccore can be used in a variable name.                
3)#MEAN
WRONG
No special symbol other than undersccore can be used in a variable name.
4)group.
WRONG
No special symbol other than undersccore can be used in a variable name.

5)422
WRONG
The first character in the variable name must be an alphabet or imderscore(_)

6)population in 2006
WRONG
No commas or blanks are allowed within a variable name.
7)over time
WRONG
No commas or blanks are allowed within a variable name.
8)mindovermatter
Correct
9)FLOAT
WRONG
Keywords can not be used as variable names if we do so, we are trying to assign a new meaning to rhe keywoed which is not allowed by the computer.
10)hELLO
OK
11)queue.
WRONG
No special symbol other than undersccore can be used in a variable name.
12)team'svictory

WRONG
No special symbol other than undersccore can be used in a variable name.
13)Plot # 3
WRONG
No special symbol other than undersccore can be used in a variable name.
14)2015_DDay
WRONG
The first character in the variable name must be an alphabet or imderscore(_)
[B] Point out the errors, if any in the following C statements:
(a) int  = 314.562 * 150

Correction = float = 314.562*150

(b) name = 'ajay';
OK

(c) varchar = '3';
OK

(d) 3.14*r*h = vol_of_cyl;
Correction =  vol_of_cyl = 3.14*r*h;

(e) k = (a*b)(c+(2.5a+b)(d+e)

(f)m_inst = rate of interest*amount in rs;
Correction = m_inst = rate_of_interest*amount_in_rs;

(g) si = principal*rateofinterest*numberofyears/100;
OK

(h)area = 3.14*r**2;
Correction => area = 3.14*r*r;
(i) volume => 3.147*r*r*h;

(j) k =  ((a*b)+c)(2.5*a+b)
Correction =>  k = ((a*b)+c)*(2.5a+b)

(k) a = b  = 3 = 4
Correction => a = b = 3

(l) count = count +1;
OK

m) date = '2Mar 03;
OK