Math and Arithmetic

Statistics

C Programming

Numbers

# Write a program to input two numbers and print their sum product difference and quotient?

## Answer

###### Wiki User

###### 11/29/2012

#include<stdio.h>

void main()

{

int a,b,c;

printf("enter value of a and b:");

scanf("%d %d",&a,&b");

c=a+b;

printf("sum is %d",c);

c=a*b;

printf("\n product is %d"c);

c=a-b;

printf("difference is%d",c);

c=a/b;

printf('quotient is%d",c);

getch();

}

## Related Questions

###### Asked in Computer Programming

### How do you Write a program that allows the user to input a number and compute for the sum difference product and quotient in simple way?

You cannot compute the sum, difference, product or quotient of a
single number. All these operations are binary operations which
means they require two operands, which we'll call a
and b.
In pseudocode, our program will be something like the
following:
input a
input b
print "sum = "
print a + b
print "difference = "
print a - b
print "product = "
print a * b
print "quotient = "
print a / b
This could be implemented in C++ as follows:
#include<iostream>
int main (void) {
using namespace std;
double a,...

Read More

###### Asked in Computer Programming, Visual Basic Programming, C++ Programming

### Write a program that asks the user to enter 2 numbers obtains the two numbers from the user and print the sum products difference and quotient of the two numbers?

Private Sub Command1_Click()
dim a as integer
dim b as integer
dim c as integer
dim d as integer
a=txt1.text+txt2.text
b=txt1.text-txt2.text
c=txt1.text*txt2.text
d=txt1.text/txt2.text
msgbox "Sum: " & a & vbNewLine & "Difference :"
& b & vbnewline & "Product :" & c
&vbnewline& "Quotient :"& d,vbinformation,"Info"
End Sub
...

Read More

###### Asked in Java Programming

### Write a java program to print difference of N numbers?

It isn't clear what you mean by the "difference of N numbers".
"Difference" is normally defined just for two numbers, so you would
need to clarify what calculations are to be done in the case of
more than two numbers.
...

Read More

###### Asked in C++ Programming

### How do you write a program in c plus to input two numbers and compute for the sum difference product and quotient?

#include<iostream>
#include<sstream>
int main(void) {
using namespace std;
double a {}, b {}; // zero-initialised
while (true) {
cout<<"Input two non-zero numbers: ";
stringstream ss {};
cin>>ss;
if (ss>>a && ss>>b && a &&
b) break; // input parsed correctly!
cout<<"Error: numbers not recognised!\n!";
}
cout<<"Sum = "<<a+b<<endl;
cout<<"Difference = "<<a-b<<endl;
cout<<"Product = "<<a*b<<endl;
cout<<"Quotient= "<<a/b<<endl; // beware of
division by zero!
}
Note that the while loop handles all input errors. The
input and output streams both operate on character sequences, so
placing the current input into a localised stringstream is by far
the safest and...

Read More

###### Asked in Computers, Computer Programming

### What Difference of a computer program and a computer programmer?

a computer program is an arts or science but the computer
programmer is conducc a thousands of letters or numbers
...

Read More

###### Asked in Prime Numbers

### With a given big integer number which is the product of two prime numbers how do you find them?

First write a program to generate the prime number. After one
prime number was generated, divide the big int number by the prime
number. If the remainder is zero then quotient is the second prime
number ( also it is important to check whether the quotient is
prime number or not because sometimes you will get wrong answer).
Repeat the process until you get the result.
...

Read More

###### Asked in The Difference Between

### What is the difference between photoshop and inkscape?

Photoshop is a raster/pixel-based program, and is also a product
you have to purchase. Inkscape is a vector drawing program that's
free.
...

Read More

###### Asked in The Difference Between

### What is the difference between qualitative and quantitative prediction?

Qualitative predictions are predictions based on quality. How
effective is the product, or program expected to be?
Quantitative predictions are based on quantities, in other
words, numbers. How many people, products or units are
expected.
...

Read More

###### Asked in C Programming

### What is c program to calculate product of all even numbers from entered number down to 1?

c is programming laungage

Read More

###### Asked in Intel 8085

### Write an assembly language program for addition of two 8 bit number?

Write a menu driven program to read two integers & find
their sum, difference & product
...

Read More

###### Asked in Computer Programming

### Conversion of decimal to binary in fortran?

This is not a perfect program, but it will get you started in
the right direction. Works for any INTEGER up to "some" power of 2
(decimals kill the program).
PROGRAM binary
IMPLICIT NONE
INTEGER remainder, quotient, n, int_input, answer
REAL input, dec_input
WRITE(*,*) 'Input a number to convert to binary'
READ(*,*) input
int_input = input
dec_input = input - int_input
dec_input = abs(dec_input)
quotient = abs(input)
DO WHILE (dec_input==0)
n = 0
answer = 0
DO WHILE (quotient>1)
remainder = mod(quotient,2)
quotient = quotient/2
answer = answer+remainder*10.**n
n = n+1
END DO
IF (input<0) answer =...

Read More

###### Asked in Computers, Computer Programming, Computer History

### Who was the first person to program a computer?

Augusta Ada Byron was Charles Babbage's collaborator on the
'difference engine'.
She wrote the first computer program to calculate Bernoulli
numbers.
...

Read More

###### Asked in Microsoft PowerPoint

### How do you find your product key for my Microsoft PowerPoint?

The product key is a unique code of letters and numbers and
sometimes symbols It can be found either on the disk, on top of the
disk or even in the program for Microsoft PowerPoint.
...

Read More

###### Asked in Computers

### What is the difference between Pseudo-code and an actual computer software program?

the difference between that two words is the spelling, numbers
of letters and the first letter in that two particular words
...

Read More

###### Asked in Academic Writing, Definitions, The Difference Between

### Difference between solicitation and advertisement?

Advertising is where you present a program, product, or
service to a viewer and it is at their liberty to accept it, show
their individual interests in it or reply to it and/or acknowledge
it with interests; whereas Soliciting is where you are forcefully
walking into an environment and introducing a product, program or
service to prospects that may or may not be interested in the offer
that you are presenting.
...

Read More

###### Asked in The Difference Between

### What is the What is the difference between program and program?

Program is the US spelling.Programme is the UK spelling.

Read More

###### Asked in Computer Terminology, Java Programming, Visual Basic Programming

### What is the pseudo code for a program that finds the product of two numbers?

int x; //first number
int y; //second number
int z = x*y;

Read More

###### Asked in C++ Programming, Prime Numbers

### How do I wwrite a Program that prints all prime numbers from an array?

How do Iwrite a Program that prints all prime numbers from an
array?

Read More

###### Asked in C Programming

### Algorithm and flow chart of the program for ascending and descending order of numbers?

A flow chart can be used to write a program that can sort
numbers. The program should be able to sort numbers by either
ascending or descending order as needed.
...

Read More

###### Asked in Math and Arithmetic

### Find the largest palindrome made from the product of two 3-digit numbers?

906609=913*993
I found this using a relatively simple computer program that I
wrote.
...

Read More

###### Asked in Microsoft Excel

### What is Excel on computers?

Excel is a specialized program that manages numbers in various
ways. It uses spreadsheets and data to process a large amount of
numbers. One enters the data, or numbers, and the program
calculates the numbrs in the manner you designate in the
program.
...

Read More

###### Asked in Business and Industry, Management and Supervision, Project Management

### What is the difference between a project and a program?

A Project is a temporary endeavor taken up to produce a product
or achieve an objective.
A program may be a part of a higher-level program; it certainly
contains some interrelated projects, and it may contain some
non-project work as well. Program management focuses on optimally
managing the inter-dependencies among the various projects in the
program. The person who manages a program is called the Program
Manager.
...

Read More

###### Asked in Intel 8085

### Program to count the number of numbers in an array using 8085 microprocessor?

A program which is used to count the number of numbers in an
array using a 8085 microprocessor is known as a assembly language
program.
...

Read More

###### Asked in Math and Arithmetic, C Programming, Algebra, How To

### How to write a C program to find largest 2 numbers using pointers?

program to find maximum of two numbers using pointers

Read More