Количество предложений
include <stdio.h>
include <string.h>
include <stdbool.h>
int main(){ char n[250]; int say=0; bool s=true; gets(n); int size=strlen(n); for(int i=0 ;n[i]!='\0' ;i++){ if(n[i]=='.' || n[i]=='?' || n[i]=='!'){ s=true; }
else if(s){
say++;
s=false;
}
}
printf("%d",say);
return 0;
}
c# - 100%
using System; namespace ConsoleApp1 { internal class Program { static void Main(string[] args) { string s = Console.ReadLine(); if (s.Length == 0) Console.WriteLine(0); else if (s.Length == 1) Console.WriteLine(1); else { int c = 1; for (int i = 0; i < s.Length - 1; i++) { if (s[i] == '!' || s[i] == '?' || s[i] == '.') { if (s[i + 1] == ' ') c++; } } Console.WriteLine(c); } Console.ReadKey(); } } }
include <stdio.h> include <string.h> include <stdbool.h> int main(){ char n[250]; int say=0; bool s=true; gets(n); int size=strlen(n); for(int i=0 ;n[i]!='\0' ;i++){ if(n[i]=='.' || n[i]=='?' || n[i]=='!'){ s=true; }
else if(s){
say++;
s=false;
}
} printf("%d",say);
return 0; }