let x be the number of units consumed
and y be the number of days
and p be the electricity bill
Required codes are-
#include<stdio.h>
main()
{int x,y,p;
printf("please enter the number of consumed units and number of days consumed");
scanf("%d%d",&x,&y);
if(x 200)
{p=2 x;
}
if(x 200&&x 400)
{p=200 2+(x-200) 4;
}
if(x 400)
{p=4 x;
}
if(y 15)
printf("price is %d",p);
else
{ ;
printf("price is %d",p);
}
}
Comments