Rohit has 'A' Chocolates and Mohit has 'B' Chocolates. Rohit will do the following action 'K' times.If Rohit has one or more Chocolates, eat one of his Chocolates.Otherwise, if Mohit has one or more Chocolates, eat one of Mohit's Chocolates.If they both have no Chocolates, do nothing.
#include<stdio.h>
int main()
{int A,B,K;
scanf("%d %d %d",&A,&B,&K);
if(A>=K)
printf("%d %d",(A-K),B);
else if (A<=K)
printf("%d %d",0,B-(K-A));
return 0;}
Comments
Post a Comment