Operación en Java

En esta sección se resolverán dudas relacionadas con el lenguaje de programación de Oracle Java

Moderator: julianmartinez16

Post Reply
User avatar
nathalia_ortega
Posts: 55
Joined: Fri Jan 22, 2016 9:20 am

Operación en Java

Post by nathalia_ortega » Tue Aug 23, 2016 9:23 am

Code: Select all

public class HolaMundo
 {
  public static void main(String args[])
   {
   	double x, y, r;
   	x=5;
   	y=7;
   	r=(((3*x+2)/(5+3*y))/((1+((3*x)/(2*x+1)))))+(1/((2*x)+(1/(2*x+2))));
   	System.out.println(r);

   }
}

Code: Select all

C:\Users\B09S105est\Desktop\lp_holamundo>"C:\Program Files\Java\jdk1.8.0_91\bin\javac" HolaMundo.java

C:\Users\B09S105est\Desktop\lp_holamundo>java HolaMundo
0.37580077265391953

C:\Users\B09S105est\Desktop\lp_holamundo>pause
Presione una tecla para continuar . . .
https://www.wolframalpha.com/input/?i=( ... *x%2B2))))
Last edited by nathalia_ortega on Tue Aug 23, 2016 9:46 am, edited 2 times in total.
Nathalia A. Ortega

User avatar
Mangel21
Posts: 30
Joined: Fri Jan 22, 2016 8:06 am

Re: Operación en Java

Post by Mangel21 » Tue Aug 23, 2016 9:24 am

Image
https://www.wolframalpha.com/input/?i=( ... *x%2B2))))

Code: Select all

C:\Users\B09S105est\Desktop\Nueva carpeta>"C:\Program Files\Java\jdk1.8.0_91\bin\javac" Animal.java

C:\Users\B09S105est\Desktop\Nueva carpeta>java Animal
El resultado es 0.37580077265391953

C:\Users\B09S105est\Desktop\Nueva carpeta>pause
Presione una tecla para continuar . . .

Code: Select all

public class Animal{

	public static void main(String[] args){

		double x;
		double y;
		double r;
		


		x=5;
		y=7;
		r=(((3*x+2)/(5+3*y))/(1+((3*x)/(2*x+1))))+(1/(2*x+(1/(2*x+2))));
		System.out.println("El resultado es "+r);

	}
}
Last edited by Mangel21 on Tue Aug 23, 2016 9:50 am, edited 2 times in total.
Brayan O.Sud0 :D
Logica Programación

User avatar
Mangel21
Posts: 30
Joined: Fri Jan 22, 2016 8:06 am

Re: Operación en Java

Post by Mangel21 » Tue Aug 23, 2016 9:49 am

Equipo 1
Imprimir si un numero es par o impar

Code: Select all

C:\Users\B09S105est\Desktop\Nueva carpeta>"C:\Program Files\Java\jdk1.8.0_91\bin\javac" Animal.java

C:\Users\B09S105est\Desktop\Nueva carpeta>java Animal
No es par

C:\Users\B09S105est\Desktop\Nueva carpeta>pause
Presione una tecla para continuar . . .


Code: Select all

public class Animal{

	public static void main(String[] args){

		double n;
		n=23;

		if (n%2==0) {
			System.out.println("Es par");
			
		}else{
			System.out.println("No es par");
		}


	}
}
Brayan O.Sud0 :D
Logica Programación

User avatar
julianreco1
Posts: 48
Joined: Fri Jan 22, 2016 8:09 am

Re: Operación en Java

Post by julianreco1 » Tue Aug 23, 2016 9:55 am

Promedio

Code: Select all

public class 2
{
	public static void main(String args[])
	{
		double a,b,c,d,e,f,g,h,i,j;
		a = 1;
		b = 2;
		c = 3;
		d = 4;
		e = 5;
		f = 6;
		g = 7;
		h = 8;
		i = 9;
		j = 10;

		r=((a+b+c+d+e+f+g+h+i+j)/10);
		System.out.println(r);
	}
}
Julian Restrepo
Programacion Orientada a Objetos - POO
хотят знать, что Ха-ха привет :?

Post Reply