+ 1
Write a cprogram to find the sum of two numbers
pls answer
4 Respostas
+ 7
Do it yourself please. It's also easy to do it.
+ 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);
}
+ 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;
}
}
}
+ 1
tq all