GoConqr has a new look! Let us know what you think.

Notes

Aula Sala 22/05

Henrique Marcio Leonel Algoritimos de Programação Orientada a Objetos I English 1 page

Content of the notes (1)

Page 1

Exercício

Escreva um programa que verifique se uma frase é um Palíndromo:

// Palindromo

// AlgprogooI 22/05

import java.util.Scanner;

public class Main

{

public static void main(String[] args)

{

frase = teclado.nextLine();

ini = 0; teste=true;

frase = frase.ToLowCasw();

frase = frase.replaceAll("^ [a.z]", "");

tamanho = frase.lenght();

fim = tamanho;

while (teste && ini <= tamanho/2)

{

char A = frase.charAt(ini);

char B = frase.charAt(fim);

if (A != B) {

teste = false;

}else

{

ini++;

fim--;

}

}

if (teste) System.out.println( frase + "é palindromo");

else System.out.println( frase + "não é palindromo");

}

}

Information

Description
Algoritimos de Programação Orientada a Objetos I Note on Aula Sala 22/05, created by Henrique Marcio Leonel on 22/05/2017.
Created by
Henrique Marcio Leonel · May 2017
Updated
May 22, 2017
Views
1
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?