Math, asked by AbithaBaby, 8 months ago

write a program to find sum of 2 numbers without using fuction​

Answers

Answered by pg2122777
2

Answer:

class sum

{

public static void main (String args [])

{

double a=5;

double b=2;

double c=a+b;

System.out.print("SUM="+c);

}

}

Step-by-step explanation:

Hope it helped...

Answered by Anonymous
2

\huge\mathfrak\red{Here's\:Your\:Answer}

\bf\mathtt\blue{Normal\:Method}

class sum

{

void main()

{

int a = 10;

int b= 20;

int sum = a+b;

System.out.println("Sum is : "+sum);

}

}

\bf\mathtt\pink{Scanner\:Method}

import java.util.*;

class sum

{

void main()

{

Scanner sc = new Scanner(System.in);

System.out.println("Enter two numbers");

int a = sc.nextInt();

int b = """""""""""""";

int sum =0;

sum = a+b;

System.out println("Sum of two numbers is : " +sum);

}

}

Similar questions