This is a official website of instagram page @coding_planet

Saturday, November 10, 2018

Add Two Numbers (Python #1)

  Python  Program To Add Two Numbers 


Input:




num1 = 4.7
num2 = 8.3


sum = float(num1) + float(num2)


print('The sum of {0} and {1} is {2}'.format(num1, num2, sum))

Output:



The Sum Of 4.7 And 8.3 Is 13

Share:

Add Two Numbers (Java #1)

  Java  Program To Add Two Numbers 


Input:


public class AddTwoIntegers {

    public static void main(String[] args) {
        
        int first = 15;
         int second = 10;

        int sum = first + second;

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

Output:



Enter Two Numbers: 15 10
The Sum Is: 25

Share:

Substract Two Numbers (C++ #3)

C++ Program To Substract Two Numbers 


Input:


#include<stdio.h>

int main()
{
 int a,b,sub;

 
 printf("Enter the first no.: ");
 scanf("%d",&a);

 
 printf("Enter the second no.: ");
 scanf("%d",&b);

 
 sub= a-b;
 printf("subtract is = %d\n", sub);

 return 0;
}

Output:



First run:
Enter the first no.: 10
Enter the second no.: 18
subtract is = -8

Second run:
Enter the first no.: 25
Enter the second no.: 10
subtract is = 15

*** Use Turbo C/C++ Or Dec C++ For Coding ***

Share:

Add Two Numbers (C++ #2)

        C++ Program To Add Two Numbers 


Input:


/* C++ Program - Add Two Numbers */
  
#include<iostream.h>
#include<conio.h>
void main()
{
 clrscr();
 int a, b, sum;
 cout<<"Enter two number :";
 cin>>a>>b;
 sum=a+b;
 cout<<"Sum of the two number is "<<sum;
 getch();
}

Output:

*** Use Turbo C/C++ Or Dec C++ For Coding ***

Share:

C++ Programming Example 1 (Hello World)

                                      C++ "Hello, World !" Program


  •         A Simple C++ Program For Displaying "Hello, World" on Screen 
  •         Its A Very Simple Program
  •         Used To Illustrate Syntax Of a Programming Launguage

Input:

                                                #include <iostream.h>

                                                using namespace std;



                                                 int main() 

                                                 {

                                              cout << "Hello, World!";
                                                   return 0;
                                                  }


Output:
Hello World       

*** Use Turbo C/C++ Or Dev C++ For Coding ***

Share:

About

Blogger templates

3/recent/post-list