WAP to accept basic salary of an employee?
Calculate it HRA=25%,DA=30%,PF=30%&net salary display all
contents?

Answer Posted / yarmia anuj kalundia

the program does not yield proper result, cos long int is
used and then only "%d", instead just use "%ld" like i did
in following
"#include<stdio.h>
void main()
{
long int bs,da,hra,pf;
printf("\nEnter The Basic Salary of Employee: ");
scanf("%ld",&bs);
printf("\nDA : %ld",da=bs*30/100);
printf("\nHRA : %ld",hra=bs*25/100);
printf("\nPF : %ld",pf=bs*30/100);
printf("\nNet Salary: %ld",da+hra+pf);
}

Is This Answer Correct ?    20 Yes 17 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

The % symbol has a special use in a printf statement. How would you place this character as part of the output on the screen?

766


Should a function contain a return statement if it does not return a value?

592


What is assignment operator?

620


What is assert and when would I use it?

573


Explain built-in function?

587






What's a good way to check for "close enough" floating-point equality?

621


Why we use int main and void main?

533


Differentiate between new and malloc(), delete and free() ?

666


pierrot's divisor program using c or c++ code

1724


Why does everyone say not to use scanf? What should I use instead?

678


How do you determine a file’s attributes?

598


Write a program to reverse a linked list in c.

639


How can I use a preprocessorif expression to ?

598


What are the properties of union in c?

584


Why doesnt this code work?

616