Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  ans.c
Language: C/C++
Code:
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>

int main() {

    int t, n, c, m,cnt=0;

printf("n enter..");
    scanf("%d", &t);
    while ( t-- )
    {
    printf("n enter..");
        scanf("%d%d%d",&n,&c,&m);
        int answer = 0; 
        /** Write the code to compute the answer here. **/
         while(n>=c)
        {
            n-=c;
            answer++;
            cnt++;
            
        }
printf("ncount:%d %d",answer,cnt);
        while(1)
        {
        if(cnt>=m)
                {
                cnt-=m;    
                answer++;
                 cnt++;  
                }
            else
                        break;
        }
        printf("%dn",answer);
    }
    return 0;
}
          
Comments: