<br />
<b>Warning</b>:  Undefined array key "global_protection_id" in <b>/home/wikitechy/public_html/interview-questions/wp-content/plugins/content-protector/inc/class-ps-rest-handler.php</b> on line <b>51</b><br />
{"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 &lt;stdio.h&gt;<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]&gt;=&#039;0&#039; &amp;&amp; str[counter]&lt;=&#039;9&#039;)<br\/>            countDigits++;<br\/>        else if((str[counter]&gt;=&#039;A&#039; &amp;&amp; str[counter]&lt;=&#039;Z&#039;)||(str[counter]&gt;=&#039;a&#039; &amp;&amp; str[counter]&lt;=&#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":{"passster_activate_protection":false,"passster_protect_child_pages":"","passster_protection_type":"password","passster_password":"","passster_activate_overwrite_defaults":"","passster_headline":"","passster_instruction":"","passster_placeholder":"","passster_button":"","passster_id":"","passster_activate_misc_settings":"","passster_redirect_url":"","passster_hide":"no","passster_area_shortcode":"","gtb_hide_title":false,"gtb_wrap_title":false,"gtb_class_title":"","gtb_remove_headerfooter":false,"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 v22.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\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\":\"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\":\"required name=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:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/image\/\",\"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":"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":"required name=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:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/image\/","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}]}}