Saturday 15 October 2011

(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.



/* This program takes basic salary from user, calculates dearness and house rent
allowances and then gross salary and shows results.*/
#include<stdio.h>
#include<conio.h>
int main ()
{
    /*declaring veriables*/
    float bsalary, dallow, hrallow, grsalary;
   
    /*prompt to take bsalary as input*/
    printf("Please enter the basic salery: ");
   
    /*taking input*/
    scanf("%f",&bsalary);
   
    /*calculations*/
    dallow = 0.4* bsalary;
    hrallow = 0.2 * bsalary;
    grsalary = bsalary + dallow + hrallow;
  
    /*showing results*/
    printf("\n\nBasic Salary          :          %f Rs\n",bsalary);
    printf("\nDearness Allownce     :          %f Rs \n",dallow);
    printf("\nHouse Rant Allownce   :          %f Rs \n",hrallow);
    printf("___________________________________________\n");
    printf("\nGross Salary          :          %f Rs\n",grsalary);
    getche();
    return 0;
}


13 comments:

  1. Nice Dude Have Professional Writing Style, g8
    Visit My Blog

    ReplyDelete
  2. There are some errors... Such as Salary, Rent and getch()... You have written Salery, Rant and getche... Rant means shouting in anger and salery is meaningless.....

    ReplyDelete
  3. its vary nice and simple to write...thanque

    ReplyDelete
  4. ramesh basic salary is input through the keyboard his derness allowance is 20% of basic salary write a program to calculate his gross salary

    ReplyDelete
  5. thanks for solve the qustion

    ReplyDelete
  6. More simpler solution for this is

    void main()
    {
    float basic_salary, dearness, house_rent, gross_salary;
    clrscr();
    printf("Enter the basic salary\n");
    scanf("%f", &basic_salary);
    dearness=40*basic_salary/100;
    house_rent=20*basic_salary/100;
    gross_salary=basic_salary+dearness+house_rent;
    printf("Gross salary is %f", gross_salary);
    getch();
    }

    ReplyDelete
  7. The best i can found. thank you. :)

    ReplyDelete
  8. Very easy to understand. Thank You.

    ReplyDelete
  9. It's very easy code thanks and provide more code....
    (If the string "Alice in wonder land" is fed to the following scanf( ) statement, what
    will be the contents of the arrays str1, str2, str3 and str4?
    scanf ( "%s%s%s%s%s", str1, str2, str3, str4 ) ;)
    Like that.....

    ReplyDelete
  10. Very simple and easy to understand thank you very much

    ReplyDelete
  11. Thanks for solve the question

    ReplyDelete
  12. Casino Hotel Tunica Tickets - JT-Mobile Arena
    Get 거제 출장안마 the 김포 출장마사지 best deals on Concert at JT-Mobile Arena, featuring popular music, interactive 강원도 출장안마 theater, dining and nightlife. JT-Mobile Arena provides concerts Fri, Dec 17Keith SegalSat, Dec 18Jameson 상주 출장마사지 Rodgers 하남 출장샵

    ReplyDelete