c program for addition of two numbers code example

Example 1: add 2 numbers in c

#include<stdio.h>
int main() {
int a, b, sum;
printf("\nEnter two no: ");
scanf("%d %d", &a, &b);
sum = a + b;
printf("Sum : %d", sum);
return(0);

Example 2: addition of two numbers in c

int num1,num2;
printf("%d",num1+num2);

Example 3: how to use addition in c

#include <stdio.h>
int main() {    

    int number1, number2, sum;
    
    printf("Enter two integers: ");
    scanf("%d %d", &number1, &number2);

    // calculating sum
    sum = number1 + number2;      
    
    printf("%d + %d = %d", number1, number2, sum);
    return 0;
}

Example 4: multiplication of two numbers in c

int num1,num2;
printf("%d",num1*num2);

Tags:

Cpp Example