C# Program to Count Punctuation Characters in a String Last Updated : 25 Jul, 2022 Summarize Comments Improve Suggest changes Share Like Article Like Report C# is a general-purpose, modern and object-oriented programming language pronounced as “C Sharp”. In this article we will see the C# program, to count punctuation characters in a given string. Algorithm:First, create a string or get the string from the user.Declare a variable to count the number of punctuations. If any character is matched with the punctuations, increment the count by 1.Print the count.Example: C# // C# program for count punctuation // characters in a given string using System; namespace Count_Punctuation_characters_in_a_given_string { class Program { static void Main(string[] args) { Console.Write("Enter a string:"); string input = Console.ReadLine(); int count = 0; for(int i=0;i<input.Length;i++) { if(input[i]=='!'|| input[i]==';'|| input[i]==','|| input[i]==':'|| input[i]=='?'|| input[i]=='.') { count++; } } Console.WriteLine($"No of punctuations are:{count}"); } } } Output: Comment More infoAdvertise with us Next Article Count no. of characters and words in a string in PL/SQL A akshaysobti15 Follow Improve Article Tags : Misc C# C# Programs Practice Tags : Misc Similar Reads Program to count vowels, consonant, digits and special characters in string. Given a string and the task is to count vowels, consonant, digits and special character in string. Special character also contains the white space.Examples: Input : str = "geeks for geeks121" Output : Vowels: 5 Consonant: 8 Digit: 3 Special Character: 2 Input : str = " A1 B@ d adc" Output : Vowels: 6 min read Count Occurrences of a Given Character in a String Given a string S and a character 'c', the task is to count the occurrence of the given character in the string.Examples: Input : S = "geeksforgeeks" and c = 'e'Output : 4Explanation: 'e' appears four times in str.Input : S = "abccdefgaa" and c = 'a' Output : 3Explanation: 'a' appears three times in 6 min read Count no. of characters and words in a string in PL/SQL Prerequisite - PL/SQL introduction In PL/SQL code groups of commands are arranged within a block. A block group related declarations or statements. In declare part, we declare variables and between begin and end part, we perform the operations. Given a string and the task is to count the number of c 2 min read Count no. of characters and words in a string in PL/SQL Prerequisite - PL/SQL introduction In PL/SQL code groups of commands are arranged within a block. A block group related declarations or statements. In declare part, we declare variables and between begin and end part, we perform the operations. Given a string and the task is to count the number of c 2 min read Count of substrings having all distinct characters Given a string str consisting of lowercase alphabets, the task is to find the number of possible substrings (not necessarily distinct) that consists of distinct characters only.Examples: Input: Str = "gffg" Output: 6 Explanation: All possible substrings from the given string are, ( "g", "gf", "gff", 7 min read Java program to count the characters in each word in a given sentence Write a Java program to count the characters in each word in a given sentence? Examples: Input : geeks for geeksOutput :geeks->5for->3geeks->5 Recommended: Please solve it on PRACTICE first, before moving on to the solution. Approach:Here we have to find out number of words in a sentence an 3 min read Like