+ 1

Write a cprogram to find the sum of two numbers

pls answer

14th Nov 2017, 1:11 PM
kulu
kulu - avatar
4 Réponses
+ 7
Do it yourself please. It's also easy to do it.
14th Nov 2017, 1:34 PM
qwerty
qwerty - avatar
+ 3
#include<stdio.h> void main(){ int a,b,s; printf("Enter 2 numbers:"); scanf("%d %d",&a,&b); s=a+b; printf("Sum of %d & %d is %d",a,b,s); }
14th Nov 2017, 1:17 PM
DAB
DAB - avatar
+ 3
C# Example: https://code.sololearn.com/clgJlokmEM34/#cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { static void Main(string[] args) { int num1 = 0; int num2 = 0; Console.WriteLine("Please enter number 1: "); num1 = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Please enter number 2: "); num2 = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("The sum of " + num1 + " and " + num2 + " is " + getSum(num1, num2)); } public static int getSum(int number1, int number2) { return number1 + number2; } } }
14th Nov 2017, 1:26 PM
AgentSmith
+ 1
tq all
16th Nov 2017, 3:21 PM
kulu
kulu - avatar