Saturday, August 25, 2018

REPORT AND ADD!!

  • Problem Description

    Lakshmans favourite subject is maths. He is interested to do calculations. His maths teacher ask him to write a code to detect the numbers which are divided by 5 and the output will be the number of dividents and their sum value. 

    Your task is to help Lakshman to complete the work.
  • CODING ARENA
  • #include <stdio.h>
    int main()
    {
      int i,num1,num2,count=0,sum=0;
      scanf("%d %d",&num1,&num2);
      for(i=num1;i<num2;i++)
      {
        if(i%5==0)
        {
          count++;
          sum=sum+i;
        }
      }
      printf("%d %d",count,sum);
    return 0;
    }
  • Test Case 1

    Input (stdin)
    50 100
    
    
    Expected Output
    10 725
  • Test Case 2

    Input (stdin)
    19 29
    
    
    Expected Output
    3 45

No comments:

Post a Comment