Solução: Problema do giro da palavra (Maurício Souza Lage)
From AdonaiMedrado.Pro.Br
Revision as of 16:52, 3 April 2009 by 200.17.147.2 (Talk) (New page: <code lang="c"> #include <stdio.h> #include <string.h> int main(void) { int i, N, tamPalavra1; char palavra1[15]; char palavra2[15]; char buffer; scanf("%s", ...)
#include <stdio.h> #include <string.h> int main(void) { int i, N, tamPalavra1; char palavra1[15]; char palavra2[15]; char buffer; scanf("%s", palavra1); scanf("%s", palavra2); tamPalavra1= strlen(palavra1); for(N= tamPalavra1; N; N--) { /* printf("%s\n",palavra1); */ if (!strcmp(palavra2, palavra1)) { printf("1\n"); return 0; } else { buffer= palavra1[0]; for(i=1; i < tamPalavra1; i++) palavra1[i - 1] = palavra1[i]; palavra1[tamPalavra1- 1]= buffer; } } printf("0\n"); return 0; }