Skip to content

Instantly share code, notes, and snippets.

@valchaqui
Created November 4, 2015 13:12
Show Gist options
  • Save valchaqui/fe5e5c27e59897b6c280 to your computer and use it in GitHub Desktop.
Save valchaqui/fe5e5c27e59897b6c280 to your computer and use it in GitHub Desktop.
import java.util.*;
public class nomes {
public static void main(String [] x) {
String nome;
String b = "marcelo";
int i, marcelo=0, novo;
Scanner ler = new Scanner(System.in);
for(i=0;i<10;i++){
System.out.print("Digite o "+(i+1)+".o nome: ");
nome = ler.nextLine();
if(nome.equals(b)){
marcelo++;
}
}
novo=marcelo++;
System.out.print("\n\nExistem "+novo+" nomes -MARCELO- digitados");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment