Program to add two numbers using function

Problem Statement:- Program for the addition of two numbers using function.

Sample Input/Output:-

 Sample Input First:56 Sample Output First: 11 Sample Input Second: 10077 Sample Output Second: 177

Data requirement:-

Input Data:- num1, num2

Program in C

Code:

Program in C++

Here is the source code of the C++ Program to add two numbers using function.

Code:

``import java.util.Scanner;public class SumOfTwoNumbers {    /* This function calculating additon of two numbers. */    static int additionOfTwoNumbers(int num1, int num2) {        /*         * Calculating the sum of two numbers and store  into sum variables         */        int sum = num1 + num2;        return sum;    }    public static void main(String[] args) {        Scanner sc = new Scanner(System.in);        int num1, num2;        /* Get the input of two variables */        System.out.print("Enter the Two Numbers:");        num1 = sc.nextInt();        num2 = sc.nextInt();        /* Call Function addition_two_numbers with            two Parameters */        int add = additionOfTwoNumbers(num1, num2);        /* Display sum of two numbers */        System.out.println("Addition of two Numbers is: " + add);        sc.close();    }}``Input/Output:Enter the Two Numbers:33 102Addition of two Numbers is: 135

Program in Python

Code: