sum of two numbers

Solutions on MaxInterview for sum of two numbers by the best coders in the world

showing results for - "sum of two numbers"
Hans
16 Nov 2017
1#include <stdio.h>
2int main() {    
3
4    int number1, number2, sum;
5    
6    printf("Enter two integers: ");
7    scanf("%d %d", &number1, &number2);
8
9    // calculating sum
10    sum = number1 + number2;      
11    
12    printf("%d + %d = %d", number1, number2, sum);
13    return 0;
14}
15
Esteban
21 Nov 2017
1int num1,num2;
2printf("%d",num1+num2);
Christi
01 Jun 2019
1<html>
2<head>
3    <script type="text/javascript">
4        function sum() {
5            var num1 = Number(document.getElementById("field").value);
6            var num2 = Number(document.getElementById("field2").value);
7            var sum= num1+num2;
8            alert("The sum is" +" "+ sum);
9        };
10    </script>
11</head>
12 
13<body>
14    <h2>Adding two Number</h2>
15    <form>
16 
17        <input type="text" placeholder="Enter A Number" id="field"><br><br>
18        <input type="text" placeholder="Enter A Number" id="field2"><br><br>
19        <input type="button" value="ADD" onclick="sum()" />
20    </form>
21</body>
22</html>
23
Lilli
10 Oct 2019
1#include<stdio.h>
2int main() {
3int a, b, sum;
4printf("\nEnter two no: ");
5scanf("%d %d", &a, &b);
6sum = a + b;
7printf("Sum : %d", sum);
8return(0);
similar questions
queries leading to this page
sum of two numbers