Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maths operators #8

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions C++/mathematicaloperators.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include<iostream>
using namespace std;
int main()
{
int a,b;
cin>>a>>b; //input of two numbers
cout<<a+b<<endl; //sum of two numbers
cout<<a-b<<endl; //difference of two numbers
cout<<a%b<<endl; //modulo i.e. remainder of division of two numbers
cout<<float(a/b)<<endl; //type casting of division to float
cout<<a/b; //type casting of division by int
cout<<a*b<<endl; //multiplication of two nos.
return 0;
}

13 changes: 13 additions & 0 deletions C/mathematicaloperators.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include<stdio.h>
int main()
{
int a,b;
scanf("%d%d",a,b); //input of two numbers
printf("%d\n",a+b); //sum of two numbers
print("%d\n",a-b); //difference of two numbers
printf("%d\n",a%b); //modulo i.e. remainder of division of two numbers
printf("%d\n",a/b); //type casting of division by int
printf("%d\n",a*b); //multiplication of two nos.
return 0;
}

11 changes: 11 additions & 0 deletions python/mathematicaloperators.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#this file contains some of the very basic mathematical calculations
a=int(input()) #input numbers
b=int(input())
print(a+b) #add two nos
print(a-b) #subtract two nos
print(a**b) #raise 5 to the power two
print(a//b) #5 divide by 2 with integer typecasting
print(a*b) #multiply of 2 nos.
print(a/b) #division of two nos with float typecasting
print(a%b) #remainder of two nos. division