Skip to content

A+B Problem

Author: Pakin Olanraktham


View Problem Statement

Source: PROGRAMMING.IN.TH

Difficulty: Very Easy

Tags: Implementation

Prerequisites:

View External Solution

คำอธิบายโจทย์

โจทย์ให้นำเข้าจำนวนเต็ม \(a\) และ \(b\) แล้วส่งออกผลรวมของ \(a\) และ \(b\)

เฉลย

เฉลย

เราสามารถรับค่า a และ b แล้วนำมาบวกกันตรงๆ ได้เลย

โค้ด
#include <stdio.h>

int main() {
    int a, b;
    scanf("%d %d", &a, &b);
    printf("%d", a+b);
}
#include <iostream>

using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    cout << a+b;
}