Showing posts with label Arithematic operations. Show all posts
Showing posts with label Arithematic operations. Show all posts

Wednesday, 13 May 2015

Python program for performing Arithematic Operations


This is basic python program for all starters. It simply takes two integer numbers adds , subtracts , multiples and divides them.





PROGRAM :
num1 = int(input('Enter First number: '))
num2 = int(input('Enter Second number '))
add = num1 + num2
dif = num1 - num2
mul = num1 * num2
div = num1 / num2
print('Sum of ' ,num1 ,'and' ,num2 ,'is :',add)
print('Difference of ',num1 ,'and' ,num2 ,'is :',dif)
print('Product of' ,num1 ,'and' ,num2 ,'is :',mul)
print('Division of ',num1 ,'and' ,num2 ,'is :',div)



OUTPUT : 
Python  - Arithematic Operations




Similar Programs :
C program for performing Arithematic Operations
Cpp program for performing Arithematic Operations
Java program for performing Arithematic Operations

Sunday, 28 December 2014

Cpp Program to perform Arithematic Operations


This is a very simple cpp program which performs the basic arithematic operations  addition , substraction , multiplication and division.


PROGRAM : 
#include <iostream>

using namespace std;

int main()
{
    float n1,n2,add,sub,mul,div;
    
    cout << "Enter 1st number: \t" ;
    cin>> n1;
    cout << "Enter 2nd number: \t" ;
    cin>>  n2;
    
    
     add= n1+n2;
     sub= n1-n2;
     mul= n1*n2;
     div= n1/n2;

    cout<<"\nSum is : \t" << add;
    cout<<"\nDifference is : " << sub;
    cout<<"\nProduct is : \t" << mul;
    cout<<"\nDivision is : \t" << div;
    
    return 0;
}
OUTPUT :

Cpp - Arithematic Operations