Adding Trouble

Question

Solution

Idea

This is another "give-away" question, and is suitable for beginners. It tests the basic use of if-else structure.

Code

https://github.com/mendax1234/Coding-Problems/blob/main/kattis/addingtrouble/addingtrouble.c
#include <stdio.h>

int main()
{
  long a, b ,c;
  scanf("%ld %ld %ld", &a, &b, &c);
  if (c == a + b)
  {
    printf("correct!\n");
  }
  else
  {
    printf("wrong!\n");
  }
}

Last updated