Wednesday, June 29, 2022

Ice cream

Ice cream

Problem Statement
Sara is fond of ice- cream initially she had N icecreams with her. If Sara eats exactly half of the ice cream she has in a day and the remaining icecreams get tripled each night. How many ice creams does Sara have at the end of D days?





static int Icecreams (int N, int D){
//Enter your code here
for(int i=1;i<=D;i++)
{
int s=N/2;
int r=N-s;
N=r*3;
}
return N;
}

No comments:

Post a Comment

ads vert

Basic HTML Tables - Layout, HTML Tables, Attributes, Aside, Footer, Tr tag, Td tag, Th tag, Tbody

  Basic HTML Tables - Layout, HTML Tables, Attributes, Aside, Footer, Tr tag, Td tag, Th tag, Tbody < table >      < thead >    ...