basic
EB READING CALCULATION IN c
#include<stdio.h>
void main(){
char name,address;
int door_number,eb_box_number;
// if we can write the mutile variable name use the _ between the words.🖋
// the variable have a some set of rule also the white space condition.🖋
float previous_reading,current_reading,units,per_unit=1.2,bill_amount;
printf("------ ELECTRICITY BOARD------\n");
printf("Name: "); //BLABLA
scanf("%s",&name);
printf("door number :"); //234
scanf("%d",&door_number);
printf("address: "); //Api
scanf("%s",&address);
/* if user can use the input function of scanf .don't give the atfter floating range like scanf("%.2",&xxxxx);incase programm like this ,the execution of the program will completly finish at this line*/ 💡
printf("EB BOX NUMBER :"); //12358
scanf("%d",&eb_box_number);
printf("previous reading:"); //500.00
scanf("%f",&previous_reading);
printf("current_reading:"); //850.00
scanf("%f",¤t_reading);
units=current_reading-previous_reading;
printf("used_units= %.2f\t units\n",units);
bill_amount=units*per_unit;
// in this area i will set the units cost defaultly
printf("bill_amount :%.2f\t rupees only",bill_amount);
// printf("rupees_only");
}
____________________________________________________________
💻
OUTPUT:
------ ELECTRICITY BOARD------
Name : BLABLA
door number :234
address : API
EB BOX NUMBER :12358
previous reading :500.00
current_reading :850.00
-----------------------------------------------
used_units= 350.00 units
bill_amount :420.00 rupees only
-----------------------------------------------------
No comments:
Post a Comment