Que 1
Que 1
Ans.
#include<stdio.h>
int main(){
int basicpay,grossalary,HRA,DA;
scanf("%d",&basicpay);
if(basicpay<=10000){
HRA = (20*basicpay)/100;
DA = (80*basicpay)/100;
else if(basicpay<=20000){
HRA = (25*basicpay)/100;
DA = (90*basicpay)/100;
else{
HRA = (30*basicpay)/100;
DA = (95*basicpay)/100;
}
return 0;
OUTPUT :
Que 2. Write a c program to input electricity unit charges and calculate total
electricity bill according to the given condition:
For first 50 units Rs. 0.50/unit
For next 100 units Rs. 0.75/unit
For next 100 units Rs. 1.20/unit
For unit above 250 Rs. 1.50/unit
An additional surcharge of 20% is added to the bill
Ans.
#include<stdio.h>
int main(){
float n,a,b,c,d,e,f;
scanf("%f",&n);
if(n<=50){
a = n*0.50 ;
b = (20*a)/100;
c =a + b;
b = 50*0.50;
n = n - 50;
c = n*0.75;
d = b+c ;
e = (20*d)/100 ;
f = d + e;
a = 50*0.50;
n = n - 150;
c = 100*0.75;
b = n*1.2;
d = a+c+b ;
e = (20*d)/100;
f = d + e;
else{
a = 50*0.50;
b = 100*0.75;
c = 100*1.20;
n = n-250;
d = n*1.50;
e = a+b+c+d;
f = (20*e)/100 + e ;
return 0;
}
Output:
Que 3. Write a program to find the greatest of three number input by the user.
Ans.
#include<stdio.h>
int main(){
int a,b,c;
scanf("%d",&a);
scanf("%d",&b);
scanf("%d",&c);
if(a>b){
if(a>c)
else if(b>c)
else
return 0;
}
Output