{"id":60,"date":"2021-09-17T08:42:32","date_gmt":"2021-09-17T08:42:32","guid":{"rendered":"https:\/\/ethosspace.com\/programmers\/?p=60"},"modified":"2021-10-11T11:56:16","modified_gmt":"2021-10-11T11:56:16","slug":"c-program-to-check-character-is-vowel-or-consonant-using-command-line-argument","status":"publish","type":"post","link":"https:\/\/ethosspace.com\/programmers\/c-program-to-check-character-is-vowel-or-consonant-using-command-line-argument\/","title":{"rendered":"C Program to check character is vowel or consonant using command line argument"},"content":{"rendered":"\n<p>Below code will check whether character passed from command line is vowel or consonant.<\/p>\n\n\n\n<p>&#8220;A&#8221;, &#8220;E&#8221;,&#8221;I&#8221;,&#8221;O&#8221;,&#8221;U&#8221; either in upper or lower case character are vowels. Other than  &#8220;A&#8221;, &#8220;E&#8221;,&#8221;I&#8221;,&#8221;O&#8221;,&#8221;U&#8221; all characters between A to Z are consonant.<\/p>\n\n\n\n<div style=\"height:25px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/Program Name: Accept a lower or Upper case character from the user from command line \n\/\/for example program name character (main.c a)\n\/\/and check whether the character is a vowel or consonant.\n\n#include&lt;stdio.h&gt;\n#include&lt;conio.h&gt;\n#include&lt;string.h&gt;\n void main(int argc, char *argv&#91;])\n {\n   char ch;\n   \/\/we are storing first character of second parameter in below way\n   ch=argv&#91;2]&#91;0];\n   \n\n\n   if((ch &gt;= 'a' &amp;&amp; ch &lt;= 'z') || (ch &gt;= 'A' &amp;&amp;ch &lt;= 'Z'))\n   {\n       if(ch=='a'||ch=='i'||ch=='o'||ch=='u'||ch=='e' ||ch=='A'||ch=='E'||ch=='I'||ch=='O'||ch=='U')\n\t       printf(\"\\n\\n %c is Vowel \",ch);\n\t    else\n\t       printf(\"\\n\\n %c is Consonant \",ch);\n   }\n   else\n      printf(\"\\n\\n %c is not character\",ch);\n    \n   getch();\n }<\/code><\/pre>\n\n\n\n<div style=\"height:25px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h4 class=\"wp-block-heading\">Output<\/h4>\n\n\n\n<div class=\"wp-block-columns has-white-color has-cyan-bluish-gray-background-color has-text-color has-background is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<p>Enter character to check for Vowel or Consonant: a<\/p>\n\n\n\n<p>a is not character<\/p>\n\n\n\n<p>a is Vowel<\/p>\n<\/div>\n<\/div>\n\n\n\n<p>While running above code from command line need to pass two arguments like &#8220;program name&#8221; &#8220;character&#8221; for e.g <strong>main.c i <\/strong>and then press enter. Program will read second string of command line and capture first character of that string and store it in variable &#8220;ch&#8221;. In If condition it is validating whether entered character is in between lower\/upper case A to Z. After successful validation it is comparing characters with vowels if not matched then it shows output as consonant.<\/p>\n\n\n\n<p>Any character which does not belong to A to Z, Program is treating it as &#8220;invalid input&#8221;.<\/p>\n\n\n","protected":false},"excerpt":{"rendered":"<p>Below code will check whether character passed from command line is vowel or consonant. &#8220;A&#8221;, &#8220;E&#8221;,&#8221;I&#8221;,&#8221;O&#8221;,&#8221;U&#8221; either in upper or lower case character are vowels. Other than &#8220;A&#8221;, &#8220;E&#8221;,&#8221;I&#8221;,&#8221;O&#8221;,&#8221;U&#8221; all characters between A to Z are consonant. Output Enter character to check for Vowel or Consonant: a a is not character a is Vowel While [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","footnotes":""},"categories":[6],"tags":[],"class_list":["post-60","post","type-post","status-publish","format-standard","hentry","category-c-language"],"aioseo_notices":[],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"sparkling-featured":false,"sparkling-featured-fullwidth":false,"tab-small":false},"uagb_author_info":{"display_name":"program45_-rt8nb","author_link":"https:\/\/ethosspace.com\/programmers\/author\/program45_-rt8nb\/"},"uagb_comment_info":0,"uagb_excerpt":"Below code will check whether character passed from command line is vowel or consonant. &#8220;A&#8221;, &#8220;E&#8221;,&#8221;I&#8221;,&#8221;O&#8221;,&#8221;U&#8221; either in upper or lower case character are vowels. Other than &#8220;A&#8221;, &#8220;E&#8221;,&#8221;I&#8221;,&#8221;O&#8221;,&#8221;U&#8221; all characters between A to Z are consonant. Output Enter character to check for Vowel or Consonant: a a is not character a is Vowel While&hellip;","_links":{"self":[{"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/posts\/60","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/comments?post=60"}],"version-history":[{"count":2,"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/posts\/60\/revisions"}],"predecessor-version":[{"id":283,"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/posts\/60\/revisions\/283"}],"wp:attachment":[{"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/media?parent=60"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/categories?post=60"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/tags?post=60"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}