viernes, 1 de julio de 2016

convert from degrees to radians using JAVA

The following program performs the conversion from degrees to radians using a static method

import java.util.Scanner;
public class Convert {
static double d, r;
static Scanner read=new Scanner(System.in);

static void deToRad(double d)
{
r=d*Math.PI/180.0;
System.out.println("Radians="+r);

}

public static void main(String args[])
{

System.out.println("Enter the value of the degrees");
double degrees=read.nextDouble();
deToRad(degrees);

}


}

Regards

jueves, 30 de junio de 2016

Sum of two integers in java


The following program is used to calculate the sum of two numbers using a static method.


public class Sum { //declaration of variables static int value1,value2,sum; static Scanner read=new Scanner(System.in); //method to add public static void add(int v1, int v2) { System.out.println("Sum="+(v1+v2)); } //main method public static void main(String args[]) { //input values System.out.println("Enter the first value=>"); int x=read.nextInt(); System.out.println("Enter the second value=>"); int y=read.nextInt(); //call the method add add(x,y); } }

good luck

miércoles, 29 de junio de 2016

Area of Rectangle


The following program calculates the area of ​​a rectangle in C

#include<conio.h> #include<stdio.h> main() { int w,h,a; //code compatible with dev -c ++ //Capture input variables printf("Area of the rectagle\n"); printf("\n Enter the width of the rectangle=>"); scanf("%d",&w); printf("\n Enter the height of the rectangle=>"); scanf("%d",&h); //calculate the area of rectangle a=w*h; //print variables printf("\n\n Area=%d",a); getch(); }



best regards

martes, 28 de junio de 2016

C language: sum of two integers


The following program performs the sum of two integers

Code:

#include<stdio.h> #include<conio.h> main() { int v1,v2,sum; printf("Enter the first value=>"); scanf("%d",&v1); printf("Enter the second value=>"); scanf("%d",&v2); sum=v1+v2; printf("\nThe sum is=%d",sum); getch(); }


Regards
The wonderful world of  programming

Programming can be wonderful or a nightmare , this site will find simple programs in various programming languages ​​that will help you better understand programming.
app-1013616_640

The codes can be used for academic purposes but NOT attributed the creation of the same