Computer Science, asked by pramit68, 3 months ago

write a program to find the sum of two numbers by accepting the number from users​

Answers

Answered by rutwikfale1518
0

Answer:

see explanation

Explanation:

In C :

  1. include <stdio.h>
  2. int main(){
  3. int num1 , num2 ,result;
  4. scanf("%d",&num1);
  5. scanf("%d",&num2);
  6. result = num1 + num2;
  7. printf("%d",result);
  8. }

Answered by allysia
0

Didn't knew what was the language requirement so did it 4 popular ones here.

Language:

Python

Program:

a=int(input("Enter a number: "))

b=int(input("Enter second number: "))

print("The sum is: ", a+b)

Language:

JAVA

Program:

import java.util.Scanner;  

public class Main  

{ public static void main(String[] args) {  

 Scanner scan =new  Scanner (System.in);  

      System.out.println("Enter a number: ");  

      int a= scan.nextInt();

     System.out.println("Enter another number: ");  

      int b= scan.nextInt();  

      System.out.println("The sum: "+(a+b))  ;}

 }

Language:

QBASIC

Program:

INPUT "Enter a number: "; a

INPUT "Enter another number:";b

PRINT "The sum is :", a+b

Language:

C++

Program:

#include <iostream>  

using namespace std;  

int main(){  

int a,b;  

cout<<"Enter the value of a: ";  

cin>> a;  

cout << "Enter the value of b: "  

cin>> b;  

cout<< "The sum : " << a+b;    

return 0;  

}

Similar questions