Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace CurrentWordInASentence
- {
- class CurrentWordInASentence
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Enter some text: ");
- string text = Console.ReadLine();
- Console.WriteLine("Enter a random word from the text: ");
- string word = Console.ReadLine();
- foreach (string sentence in text.Split('.'))
- {
- if (sentence.Contains(word))
- {
- Console.WriteLine(sentence);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement