oggi ho provato a scrivere un mio programma, che dovrebbe definire un numero come pari o dispari.
dovrebbe, al condizionale, perché ho commesso qualche errore, (tra cui segnalato "int cannot be converted to boolean") e il programma non funziona.
cos' ho sbagliato?
codice:/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package paridispari; import java.io.*; /** * * @author filipporezzadore */ public class Paridispari { /** * @param args the command line arguments */ public static void main(String[] args) { int numero; int resto = numero%2; System.out.println("inserire il numero:"); BufferedReader input = new BufferedReader (new InputStreamReader(System.in)); String line = input.readLine(); numero = Integer.parseInt(line); if (resto = 1) tipo = dispari; else tipo = pari; System.out.println("il numero digitato è:" + tipo); // TODO code application logic here } }
grazie mille per una risposta

Rispondi quotando

