Skip to content

Instantly share code, notes, and snippets.

View gmfc's full-sized avatar
🏠
Working from home

Gabriel Melo Correia gmfc

🏠
Working from home
View GitHub Profile
import javax.swing.*;
import java.io.FileWriter;
import java.io.IOException;
public class randd {
public static void main(String []args){
double seed,Xi,Xf;
double[] vetor;
int t;
import javax.swing.*;
import java.io.FileWriter;
import java.io.IOException;
public class rand {
public static void main(String[] args) {
//Xf=(a*Xi+b)%m;
double a = 25136;
double Xi;
import javax.swing.*;
import java.io.FileWriter;
import java.io.IOException;
public class rand {
public static void main(String[] args) {
//Xf=(a*Xi+b)%m;
double a = 752395;
double Xi;
import javax.swing.*;
public class rand {
public static void main(String[] args) {
//Xf=(a*Xi+b)%m;
double a = 752395;
double Xi;
double m = 254;
double b = 25;
double Xf;
@gmfc
gmfc / vetores.java
Last active December 17, 2015 14:59
Aula 22. Em construção... EDIT completo
import javax.swing.*;
class vetores{
public static void main(String [] args){
int[] vetor;
int tamanho,x,iPosicao;
do{
tamanho = Integer.parseInt(JOptionPane.showInputDialog("Entre com o tamanho do vetor"));
}while(tamanho<=0);
import javax.swing.*;
class maior{
public static void main(String args[]){
int a,b;
a = Integer.parseInt(JOptionPane.showInputDialog("Entre com o 1° número"));
b = Integer.parseInt(JOptionPane.showInputDialog("Entre com o 2° número"));
JOptionPane.showMessageDialog(null,"O maior dentre os 2 é: "+devmaior(a,b));
}
public static int devmaior(int a, int b){
public int mdc( int x, int y ){
if(x == y){
return x;
}
else if( y > x ){
return mdc( x, y-x );
}
else if( x > y ){
return mdc( x - y, y );
}
@gmfc
gmfc / fatorial.java
Created May 16, 2013 11:05
Função que calcula fatorial
clss fatorial{
public static void main(String args[]){
System.out.println(fat(10));
}
public static double fat(double n){
n==0?1:n*fat(n-1);
return n;
}
}
import javax.swing.*;
import java.lang.*;
class seno{
public static void main(String args[]){
double x, soma=0,fat,xgraus;
int n;
x = Double.parseDouble(JOptionPane.showInputDialog("Insira o angulo (em graus)"));
import javax.swing.*;
public class calculadora {
static double x,y,resultado;
static int opcao;
public static void soma(){
resultado = x+y;
}