Par Impar em Java
import java.util.Scanner;
import java.util.InputMismatchException;
 
public class par_impar    
{
 
    public static void verify(int a, int b) {
        int c = a + b;
        if(c%2 == 0){
            System.out.println("par ganhou");
        }else{
            System.out.println("impar ganhou");
        }
    }
 
    public static void main(String [] args) {
            Scanner sc = new Scanner(System.in);
            System.out.println("digite o termo para");
            int a = sc.nextInt();
            Scanner sc1 = new Scanner(System.in);
            System.out.println("digite o termo impar");
            int b = sc1.nextInt();
        verify(a,b);
    }
}

voltar

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.