Saturday, August 18, 2018

PLURAL


  • Problem Description

    We need a simple function that determines if a plural is needed or not. It should take a number, and return true if a plural should be used with that number or false if not. This would be useful when printing out a string such as 5 minutes, 14 apples, or 1 sun. All values will be positive integers or floats, or zero
  • CODING ARENA
  • #include <stdio.h>
    int main()
    {
      int a;
      scanf("%d",&a);
      if(a>1)
        printf("true");
      else
        printf("false");
        
      
    return 0;
    }
  • Test Case 1

    Input (stdin)
    1
    
    
    Expected Output
    false
  • Test Case 2

    Input (stdin)
    2
    
    
    Expected Output
    true

No comments:

Post a Comment