C program to compute the sum of the two given integer values

Write a C program to compute the sum of the two given integer values. If the two values are the same, then return triple their sum.

#include <stdio.h>

int main() {
    int a, b, sum=0;
    
    printf("Enter 2 integer value: ");
    scanf("%d %d", &a, &b);
    
    sum = a+b;
    
    if(a!=b){
        printf("%d",sum);
    }
    else
       printf("%d",sum*3);

    return 0;
}

Leave a Comment