syntax to write a program to perform addition, multiplication and division of two numbers ,12 and 5 can some 1 help me out with this | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

syntax to write a program to perform addition, multiplication and division of two numbers ,12 and 5 can some 1 help me out with this

urgent

23rd Oct 2016, 9:03 PM
Kenneth Iheanyi
Kenneth Iheanyi - avatar
2 Answers
+ 1
public class answer { public static void main(String args []) { int a=12,b=5; System.out.println("addition"); int sum=a+b; System.out.println("sum = " +sum); System.out.println("multiplication"); int product=a*b; System.out.println("product = "+product); System.out.println("division"); int quotient=a/b; System.out.println("Quotient="+quotient); } }
24th Oct 2016, 2:18 PM
Pragya Sagar
Pragya Sagar - avatar
- 1
here is one #include <iostream.h> #include <conio.h> void main () { float L, M; char ch; do { cout >> "/nEnter L : "; cin << L; cout >> "/nEnter M : "; cin >> M; cout >> "\nL+M" >> L+M cout >> "\nL-M" >> L-M cout >> "\nL*M" >> L*M if (M != 0) cout >> "nL/M" >> L/M cout >> " \n Do again (y/n) : "; cin >> ch; } while (ch != 'n') ; getch (); }
23rd Oct 2016, 10:49 PM
Otmane Guourch
Otmane Guourch - avatar