{"id":319,"date":"2021-07-12T20:12:46","date_gmt":"2021-07-12T20:12:46","guid":{"rendered":"https:\/\/www.wikitechy.com\/interview-questions\/?p=319"},"modified":"2021-09-14T06:09:48","modified_gmt":"2021-09-14T06:09:48","slug":"how-to-count-alphabets-numeric-and-special-characters","status":"publish","type":"post","link":"https:\/\/www.wikitechy.com\/interview-questions\/c\/how-to-count-alphabets-numeric-and-special-characters\/","title":{"rendered":"How to count alphabets, numeric and special characters ?"},"content":{"rendered":"<div class=\"TextHeading\">\n<div class=\"hddn\">\n<h2 id=\"how-to-count-alphabets-numeric-and-special-characters\" class=\"color-pink\" style=\"text-align: justify;\">How to count alphabets, numeric and special characters ?<\/h2>\n<\/div>\n<\/div>\n<p style=\"text-align: justify;\">In this example, we have to count digits, spaces, special characters and alphabets using C program.<\/p>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <\/div> <pre class=\"language-c code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-c code-embed-code\">#include <stdio.h><br\/> <br\/>int main()<br\/>{<br\/>    char    str[100];<br\/>    int countDigits,countAlphabet,countSpecialChar,countSpaces;<br\/>    int counter;<br\/> <br\/>    \/\/assign all counters to zero<br\/>    countDigits=countAlphabet=countSpecialChar=countSpaces=0;<br\/> <br\/>    printf(&quot;Enter a string: &quot;);<br\/>    gets(str);<br\/> <br\/>    for(counter=0;str[counter]!=NULL;counter++)<br\/>    {<br\/> <br\/>        if(str[counter]>=&#039;0&#039; && str[counter]<=&#039;9&#039;)<br\/>            countDigits++;<br\/>        else if((str[counter]>=&#039;A&#039; && str[counter]<=&#039;Z&#039;)||(str[counter]>=&#039;a&#039; && str[counter]<=&#039;z&#039;))<br\/>            countAlphabet++;<br\/>        else if(str[counter]==&#039; &#039;)<br\/>            countSpaces++;<br\/>        else<br\/>            countSpecialChar++;<br\/>    }<br\/> <br\/>    printf(&quot;\\nDigits: %d \\nAlphabets: %d \\nSpaces: %d \\nSpecial Characters: %d&quot;,countDigits,countAlphabet,countSpaces,countSpecialChar);<br\/> <br\/>    return 0;<br\/>}<\/code><\/pre> <\/div>\n<h2 id=\"output\" class=\"color-pink\" style=\"text-align: justify;\">Output :<\/h2>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <\/div> <pre class=\"language-c code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-c code-embed-code\">Enter a string: wikitechy, 789@#%12.<br\/><br\/>Digits: 5<br\/>Alphabets: 9<br\/>Spaces: 1<br\/>Special Characters: 5<\/code><\/pre> <\/div>\n","protected":false},"excerpt":{"rendered":"<p>Answer : In this example, we have to count digits, spaces, special&#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1716],"tags":[1739,491,1740,211,1857,1858,1859,1860,203,199,214,198,363,209,205,1745,1743,222,1747,196,212,710,207,366,1865,204,217,288,1744,483,206,1741,1742,1746,1861,1862,1863,1864,15851],"class_list":["post-319","post","type-post","status-publish","format-standard","hentry","category-c","tag-accentur-interview-questions-and-answers","tag-applied-materials-interview-questions-and-answers","tag-asian-paints-ltd-interview-questions-and-answers","tag-bosch-india-software-interview-questions-and-answers","tag-c-program-to-check-special-characters","tag-c-program-to-count-number-of-characters-in-a-string","tag-c-program-to-count-number-of-words-spaces-characters-digits-and-special-symbols","tag-c-program-to-find-special-characters-in-string","tag-capgemini-interview-questions-and-answers","tag-casting-networks-india-pvt-limited-interview-questions-and-answers","tag-cgi-group-inc-interview-questions-and-answers","tag-chetu-interview-questions-and-answers","tag-ciena-corporation-interview-questions-and-answers","tag-collabera-technologies-interview-questions-and-answers","tag-dell-international-services-india-pvt-ltd-interview-questions-and-answers","tag-dhfl-pramerica-life-insurance-company-ltd-interview-questions-and-answers","tag-elico-healthcare-services-ltd-interview-questions-and-answers","tag-flipkart-interview-questions-and-answers","tag-hcl-technol-interview-questions-and-answers","tag-ibm-interview-questions-and-answers","tag-indecomm-global-services-interview-questions-and-answers","tag-mavenir-interview-questions-and-answers","tag-mphasis-interview-questions-and-answers","tag-netapp-interview-questions-and-answers","tag-number-or-special-character-in-c","tag-oracle-corporation-interview-questions-and-answers","tag-peoplestrong-interview-questions-and-answers","tag-r-systems-interview-questions-and-answers","tag-raqmiyat-information-technologies-pvt-ltd-interview-questions-and-answers","tag-reliance-industries-ltd-interview-questions-and-answers","tag-sap-labs-india-pvt-ltd-interview-questions-and-answers","tag-tata-aia-life-insurance-interview-questions-and-answers","tag-tech-mahindr-interview-questions-and-answers","tag-the-linde-group-interview-questions-and-answers","tag-write-a-c-program-to-check-whether-a-character-is-uppercase-or-lowercase-alphabet","tag-write-a-c-program-to-check-whether-an-alphabet-is-a-vowel-or-consonant","tag-write-a-program-to-check-whether-an-input-character-is-digit-or-not","tag-write-a-program-to-check-whether-the-given-input-is-alphabet","tag-ziynx-interview-questions-and-answers"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to count alphabets, numeric and special characters ?<\/title>\n<meta name=\"description\" content=\"How to count alphabets, numeric and special characters ? - In this example, we have to count digits, spaces, special characters and alphabets using C program\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wikitechy.com\/interview-questions\/c\/how-to-count-alphabets-numeric-and-special-characters\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to count alphabets, numeric and special characters ?\" \/>\n<meta property=\"og:description\" content=\"How to count alphabets, numeric and special characters ? - In this example, we have to count digits, spaces, special characters and alphabets using C program\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wikitechy.com\/interview-questions\/c\/how-to-count-alphabets-numeric-and-special-characters\/\" \/>\n<meta property=\"og:site_name\" content=\"Wikitechy\" \/>\n<meta property=\"article:published_time\" content=\"2021-07-12T20:12:46+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-09-14T06:09:48+00:00\" \/>\n<meta name=\"author\" content=\"Editor\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Editor\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/c\\\/how-to-count-alphabets-numeric-and-special-characters\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/c\\\/how-to-count-alphabets-numeric-and-special-characters\\\/\"},\"author\":{\"name\":\"Editor\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#\\\/schema\\\/person\\\/4d5a581fb5470d1560324bddc5e8b757\"},\"headline\":\"How to count alphabets, numeric and special characters ?\",\"datePublished\":\"2021-07-12T20:12:46+00:00\",\"dateModified\":\"2021-09-14T06:09:48+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/c\\\/how-to-count-alphabets-numeric-and-special-characters\\\/\"},\"wordCount\":233,\"commentCount\":0,\"keywords\":[\"Accentur interview questions and answers\",\"Applied Materials interview questions and answers\",\"Asian Paints Ltd. interview questions and answers\",\"Bosch India Software interview questions and answers\",\"c program to check special characters\",\"c program to count number of characters in a string\",\"c program to count number of words spaces characters digits and special symbols\",\"c program to find special characters in string\",\"Capgemini interview questions and answers\",\"CASTING NETWORKS INDIA PVT LIMITED interview questions and answers\",\"CGI Group Inc interview questions and answers\",\"Chetu interview questions and answers\",\"Ciena Corporation interview questions and answers\",\"Collabera Technologies interview questions and answers\",\"Dell International Services India Pvt Ltd interview questions and answers\",\"DHFL Pramerica Life Insurance Company Ltd interview questions and answers\",\"Elico HealthCare Services Ltd interview questions and answers\",\"Flipkart interview questions and answers\",\"HCL Technol interview questions and answers\",\"IBM interview questions and answers\",\"Indecomm Global Services interview questions and answers\",\"Mavenir interview questions and answers\",\"Mphasis interview questions and answers\",\"NetApp interview questions and answers\",\"number or special character in c++\",\"Oracle Corporation interview questions and answers\",\"PeopleStrong interview questions and answers\",\"R Systems interview questions and answers\",\"Raqmiyat Information Technologies Pvt Ltd interview questions and answers\",\"Reliance Industries Ltd interview questions and answers\",\"SAP Labs India Pvt Ltd interview questions and answers\",\"Tata AIA Life Insurance interview questions and answers\",\"Tech Mahindr interview questions and answers\",\"The Linde Group interview questions and answers\",\"write a c program to check whether a character is uppercase or lowercase alphabet\",\"write a c program to check whether an alphabet is a vowel or consonant\",\"write a program to check whether an input character is digit or not\",\"write a program to check whether the given input is alphabet\",\"ziynx interview questions and answers\"],\"articleSection\":[\"C\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/c\\\/how-to-count-alphabets-numeric-and-special-characters\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/c\\\/how-to-count-alphabets-numeric-and-special-characters\\\/\",\"url\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/c\\\/how-to-count-alphabets-numeric-and-special-characters\\\/\",\"name\":\"How to count alphabets, numeric and special characters ?\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#website\"},\"datePublished\":\"2021-07-12T20:12:46+00:00\",\"dateModified\":\"2021-09-14T06:09:48+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#\\\/schema\\\/person\\\/4d5a581fb5470d1560324bddc5e8b757\"},\"description\":\"How to count alphabets, numeric and special characters ? - In this example, we have to count digits, spaces, special characters and alphabets using C program\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/c\\\/how-to-count-alphabets-numeric-and-special-characters\\\/\"]}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#website\",\"url\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/\",\"name\":\"Wikitechy\",\"description\":\"Interview Questions\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#\\\/schema\\\/person\\\/4d5a581fb5470d1560324bddc5e8b757\",\"name\":\"Editor\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g\",\"caption\":\"Editor\"},\"url\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/author\\\/editor\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to count alphabets, numeric and special characters ?","description":"How to count alphabets, numeric and special characters ? - In this example, we have to count digits, spaces, special characters and alphabets using C program","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wikitechy.com\/interview-questions\/c\/how-to-count-alphabets-numeric-and-special-characters\/","og_locale":"en_US","og_type":"article","og_title":"How to count alphabets, numeric and special characters ?","og_description":"How to count alphabets, numeric and special characters ? - In this example, we have to count digits, spaces, special characters and alphabets using C program","og_url":"https:\/\/www.wikitechy.com\/interview-questions\/c\/how-to-count-alphabets-numeric-and-special-characters\/","og_site_name":"Wikitechy","article_published_time":"2021-07-12T20:12:46+00:00","article_modified_time":"2021-09-14T06:09:48+00:00","author":"Editor","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Editor","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.wikitechy.com\/interview-questions\/c\/how-to-count-alphabets-numeric-and-special-characters\/#article","isPartOf":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/c\/how-to-count-alphabets-numeric-and-special-characters\/"},"author":{"name":"Editor","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/4d5a581fb5470d1560324bddc5e8b757"},"headline":"How to count alphabets, numeric and special characters ?","datePublished":"2021-07-12T20:12:46+00:00","dateModified":"2021-09-14T06:09:48+00:00","mainEntityOfPage":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/c\/how-to-count-alphabets-numeric-and-special-characters\/"},"wordCount":233,"commentCount":0,"keywords":["Accentur interview questions and answers","Applied Materials interview questions and answers","Asian Paints Ltd. interview questions and answers","Bosch India Software interview questions and answers","c program to check special characters","c program to count number of characters in a string","c program to count number of words spaces characters digits and special symbols","c program to find special characters in string","Capgemini interview questions and answers","CASTING NETWORKS INDIA PVT LIMITED interview questions and answers","CGI Group Inc interview questions and answers","Chetu interview questions and answers","Ciena Corporation interview questions and answers","Collabera Technologies interview questions and answers","Dell International Services India Pvt Ltd interview questions and answers","DHFL Pramerica Life Insurance Company Ltd interview questions and answers","Elico HealthCare Services Ltd interview questions and answers","Flipkart interview questions and answers","HCL Technol interview questions and answers","IBM interview questions and answers","Indecomm Global Services interview questions and answers","Mavenir interview questions and answers","Mphasis interview questions and answers","NetApp interview questions and answers","number or special character in c++","Oracle Corporation interview questions and answers","PeopleStrong interview questions and answers","R Systems interview questions and answers","Raqmiyat Information Technologies Pvt Ltd interview questions and answers","Reliance Industries Ltd interview questions and answers","SAP Labs India Pvt Ltd interview questions and answers","Tata AIA Life Insurance interview questions and answers","Tech Mahindr interview questions and answers","The Linde Group interview questions and answers","write a c program to check whether a character is uppercase or lowercase alphabet","write a c program to check whether an alphabet is a vowel or consonant","write a program to check whether an input character is digit or not","write a program to check whether the given input is alphabet","ziynx interview questions and answers"],"articleSection":["C"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.wikitechy.com\/interview-questions\/c\/how-to-count-alphabets-numeric-and-special-characters\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.wikitechy.com\/interview-questions\/c\/how-to-count-alphabets-numeric-and-special-characters\/","url":"https:\/\/www.wikitechy.com\/interview-questions\/c\/how-to-count-alphabets-numeric-and-special-characters\/","name":"How to count alphabets, numeric and special characters ?","isPartOf":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/#website"},"datePublished":"2021-07-12T20:12:46+00:00","dateModified":"2021-09-14T06:09:48+00:00","author":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/4d5a581fb5470d1560324bddc5e8b757"},"description":"How to count alphabets, numeric and special characters ? - In this example, we have to count digits, spaces, special characters and alphabets using C program","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wikitechy.com\/interview-questions\/c\/how-to-count-alphabets-numeric-and-special-characters\/"]}]},{"@type":"WebSite","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#website","url":"https:\/\/www.wikitechy.com\/interview-questions\/","name":"Wikitechy","description":"Interview Questions","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wikitechy.com\/interview-questions\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/4d5a581fb5470d1560324bddc5e8b757","name":"Editor","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g","caption":"Editor"},"url":"https:\/\/www.wikitechy.com\/interview-questions\/author\/editor\/"}]}},"_links":{"self":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/319","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/comments?post=319"}],"version-history":[{"count":3,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/319\/revisions"}],"predecessor-version":[{"id":3654,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/319\/revisions\/3654"}],"wp:attachment":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/media?parent=319"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/categories?post=319"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/tags?post=319"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}