Calculate the Ten, Twenty and Thirty percent of an
input number.
#include <stdio.h>
#include <conio.h>
void main ( )
{
float x, p, q, r;
clrscr ( );
printf ("\n Enter a number : -"); scanf ("%f",&x);
p = ( x * 10 ) / 100;
q = ( x * 20 ) / 100;
r = ( x * 30 ) / 100;
printf ("\n Ten percent of entered number is : - %f", p);
printf ("\n Twenty percent of entered number is : - %f", q);
printf ("\n Thirty percent of entered number is : - %f", r);
getch ( );
}
Click here to contact us
#include <conio.h>
void main ( )
{
float x, p, q, r;
clrscr ( );
printf ("\n Enter a number : -"); scanf ("%f",&x);
p = ( x * 10 ) / 100;
q = ( x * 20 ) / 100;
r = ( x * 30 ) / 100;
printf ("\n Ten percent of entered number is : - %f", p);
printf ("\n Twenty percent of entered number is : - %f", q);
printf ("\n Thirty percent of entered number is : - %f", r);
getch ( );
}
Click here to contact us
David Smit's basic pay is input through the keyboard. His dearness allowance is forty percent of basic pay, and house rent allowance is twenty percent of basic pay. So calculate his gross pay.
#include <stdio.h>
#include <conio.h>
void main( )
{
float bp, da, hra, grpay;
clrscr ( );
printf ("\n Enter the basic pay of David Smit : -"); scanf ("%f",&bp);
da = 0.4 * bp;
hra = 0.2 * bp;
grpay = bp + da + hra;
printf ("\n Gross pay of David Smit is : - %f", grpay);
getch ( );
}
Click here to contact us
#include <conio.h>
void main( )
{
float bp, da, hra, grpay;
clrscr ( );
printf ("\n Enter the basic pay of David Smit : -"); scanf ("%f",&bp);
da = 0.4 * bp;
hra = 0.2 * bp;
grpay = bp + da + hra;
printf ("\n Gross pay of David Smit is : - %f", grpay);
getch ( );
}
Click here to contact us
No comments:
Post a Comment