Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // creare un programma che da input un insieme di strinche.
- // il programma per ogni stringa immessa stampi le lettere doppie presenti nella
- // stringa termina quando รจ uguale a end
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #define SIZE 100
- int main(void) { // inizio main
- // dichiaro le variabili
- char str[SIZE];
- char end[] = "end";
- int doppie = 0;
- while (strcmp(str, end) != 0) { // inizio while
- puts("Inserisci la stringa");
- scanf("%99s", str);
- for (int i = 0; i < SIZE - 1; i++) { // inizio for
- if (str[i] == str[i + 1]) { // inizio if
- doppie++;
- printf("%s%d", "Le doppie sono: ", doppie);
- } // fine if
- } // fine del for
- } //fine while
- } // fine main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement