Wednesday, 25 March 2015

Addition of two numbers in C++

Image result for c++

For adding two numbers in c++,we have to declare variables.
We can accept numbers from user also using "cin" function or we can do it by declaring numbers to variables.
we will see both the methods.

#include<conio.h>

#include<iostream.h>

void main()
{
          int x=2,y=2,z;   

 /*here variables are of integer type which stores two bytes ,you can take it as float (decimal values) */

          z=x+y;  

          cout<<"\nX:"<<x<<"\nY:"<<y<<"Answer: "<<z;

         /*accepting from user*/
      cout<<"Enter two numbers: ";
        cin>>x>>y;

        z=x+y;

         cout<<"\nX:"<<x<<"\nY:"<<y<<"Answer: "<<z;

 getch();
}


Output:

Addition of two numbers in C




For adding two numbers in c,we have to declare variables.
We can accept numbers from user also using scanf function or we can do it by declaring numbers to variables.
we will see both the methods.

Coding:


#include<conio.h>

#include<stdion.h>

void main()
{
          int x=2,y=2,z;   

 /*here variables are of integer type which stores two bytes ,you can take it as float (decimal values) */

          z=x+y;  

          printf("X: %d\n Y: %d \n Answer: %d",x,y,z);

         /*accepting from user*/
        printf ("Enter two numbers :");

        scanf("%d%d",&x,&y);

        z=x+y;

         printf("X: %d\n Y: %d \n Answer: %d",x,y,z);

 getch();
}

Output:



          
          


First program in C++



Image result for c++

After installing the software of C language,we will start with our first program which will show how to print a string on Display Screen or Console.

Monday, 23 March 2015

First Program in Java


After installing the software of Java language,we will start with our first program which will show how to print a string on Display Screen or Console.

Sunday, 22 March 2015

How to set path in java



For setting the path For java,you need to download Java jdk.
You can Download it from below link.

Download From here: Click Here

After that,install it and follow the following steps to set the path:



  • Goto MyComputer Properties.
Preview
  • Click on Advance Tab.



how to set path in java
  • click on environment variables.
how to set path in java
  • click on new tab of user variables
how to set path in java
  • write path in variable name.
how to set path in java
  • Copy the path of bin folder
how to set path in java
  • paste path of bin folder in variable value
how to set path in java
  • click on ok button
how to set path in java
  • click on ok button
how to set path in java

  Now You can goto CMD and you can compile and run your java programs.