NOTE:- To copy the code given below point your cursor to the top right corner of code-block a copy option will appear simply click on that. 🔥🔥🔥
#include<stdio.h>
#include<conio.h>
int main()
{
printf(" PUNJAB STATE POWER CORPORATION LIMITED \n");
printf(" online portal\n");
printf("choices: 1 for current month, 2 for prev months, 3 for other months\n\n");
int choice, date, units;
long long int password;
double totalBill, extracharge, sum;
char username[45];
printf(" username ");
gets(username);
x:printf(" password ");
scanf(" %lld",&password);
if(password>9999)
{
printf(" welcome ");
puts(username);
}
else
{
printf(" wrong password\n");
goto x;
}
a:printf("enter date- ");
scanf("%d",&date);
if(date>31)
{
printf("invalid input\n");
goto a;
}
b:printf(" enter your choice- ");
scanf("%d", &choice);
switch(choice)
{
case 1:
{
printf("enter units- ");
scanf("%d",&units);
if(units>0 && units<=100)
{
totalBill= units*0.50;
printf("total bill= %lf\n",totalBill);
extracharge= 0.0;
printf("extracharge= 0.0\n");
sum= extracharge+totalBill;
printf("total sum to pay - %lf\n",sum);
}
else if(units>100 && units<=220)
{
totalBill= units*0.65;
printf("total bill= %lf\n",totalBill);
extracharge =0.0;
printf("extracharge= 0.0\n");
sum= extracharge+totalBill;
printf("total sum to pay - %lf\n",sum);
}
else
{
totalBill= units*0.80;
printf("total bill= %lf\n",totalBill);
extracharge= 0.0;
printf("extracharge = 0.0\n");
sum= extracharge+totalBill;
printf("total sum to pay= %lf\n",sum);
}
break;
}
case 2:
{
printf("enter units- ");
scanf("%d",& units);
if(units>0 && units<=100)
{
totalBill= units*0.98;
printf("total bill= %lf\n",totalBill);
extracharge=date*2.0;
printf("extracharge= %lf\n",extracharge);
sum= extracharge+totalBill;
printf("total sum to pay - %lf\n",sum);
}
else if(units>100 && units<=220)
{
totalBill= units*1.65;
printf("total bill= %lf\n",totalBill);
extracharge= date*2.0;
printf("extracharge= %lf\n",extracharge);
sum=totalBill+extracharge;
printf("total sum to pay= %lf\n",sum);
}
else
{
totalBill= units*2.36;
printf("total bill= %lf\n",totalBill);
extracharge= date*2.0;
printf("extracharge= %lf\n",extracharge);
sum= extracharge+totalBill;
printf("total sum to pay= %lf\n",sum);
}
break;
}
case 3:
{
printf("enter units- ");
scanf("%d",& units);
if(units>0 && units<=100)
{
totalBill= units*0.98;
printf("total bill= %lf\n",totalBill);
extracharge=date*2.0+315.50;
printf("extracharge= %lf\n",extracharge);
sum= extracharge+totalBill;
printf("total sum to pay - %lf\n",sum);
}
else if(units>100 && units<=220)
{
totalBill= units*1.65;
printf("total bill= %lf\n",totalBill);
extracharge= date*2.0+315.50;
printf("extracharge= %lf\n",extracharge);
sum=totalBill+extracharge;
printf("total sum to pay= %lf\n",sum);
}
else
{
totalBill= units*2.36;
printf("total bill= %lf\n",totalBill);
extracharge= date*2.0+315.50;
printf("extracharge= %lf\n",extracharge);
sum= extracharge+totalBill;
printf("total sum to pay= %lf\n",sum);
}
break;
}
default:
printf(" invalid choice \n");
goto b;
}
printf(" THANK YOU");
return 0;
getch();
}
0 Comments