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
The % symbol has a special use in a printf statement. How would you place this character as part of the output on the screen?
Should a function contain a return statement if it does not return a value?
What is assignment operator?
What is assert and when would I use it?
Explain built-in function?
What's a good way to check for "close enough" floating-point equality?
Why we use int main and void main?
Differentiate between new and malloc(), delete and free() ?
pierrot's divisor program using c or c++ code
Why does everyone say not to use scanf? What should I use instead?
How do you determine a file’s attributes?
Write a program to reverse a linked list in c.
How can I use a preprocessorif expression to ?
What are the properties of union in c?
Why doesnt this code work?