There is a Bucket of water capacity of x litres,
which is supposed to fill with a mug ofy
millilitres water capacity. Say for example x=100
and y=10 then, bucket will get full of minimum
of 8 mugs (> 80% and less than 100%>.
Bucket filling is to be stopped once more than
80% of bucket capacity is filled.
The amount of water taken at a time in mug is
not fixed as it can be any value less than or
equal to y
Notify to stop once bucket is full that is more
than 80% of capacity of bucket and count
number of mugs poured into bucket.
Note that Bucket capacity will always be greater
that Mug's Capacity.
Answers
Answered by
0
Answer:
okay.kkkkkkkkkkkkkkkkkk
Answered by
1
Answer:
#include <stdio.h>
int main()
{
int x=0,y=0,count=0,fill=0,cal=0,temp,flag=0;
printf("enter the Bucket and Mug capacity\n");
scanf("%d %d",&x,&y);
cal=x*0.8;
if(y>x)
{
flag=1;
}
else
{
printf("Enter Amount of water in MUG one after other as below\n");
while(fill<cal)
{
scanf("%d",&temp);
if(temp>y || temp<0)
{
flag=1;
break;
}
else
{ fill+=temp;
count+=1;
}
}
}
if(flag==0)
printf("Bucket Full \nnumber of mug %d",count);
else
printf("Invalid input");
return 0;
}
Similar questions