erreur sur boucle recursive
bonjour,
le programme calcul la somme de n carrés
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| import java.util.Scanner;
public class somcarre {
public static int somCarres(int n){
if (n<0) throw new PasDefini();
if ( n==0){ return 0; }
else { return (n*n)+ somCarres (n−1);}
}
public static void main(String[] args) {
int bon;
Scanner sc=new Scanner(System.in);
String st=sc.nextLine();
System.out.println(somCarres(10));
System.out.println("Hello World!");
}
} |
sure la ligne 4 jai une erreur can not find symbole
merci