Home » , » Basic C Programming Practice - Practice 4

Basic C Programming Practice - Practice 4

Written By Unknown on Thursday, October 10, 2013 | 11:32 PM

=> Write a program in C to check whether upper, lower, number or not?


Solution :


#include<stdio.h>
#include<conio.h>
main()
{
      char ch;
      printf("Please Enter Your Quarry : ");
      scanf("%c",&ch);
      if(ch>='A'&&ch<='Z')
      printf("It's An Upper Case Character.");
      else
      if(ch>='a'&&ch<='z')
      printf("It's An Lower Case Character.");
      else
      if(ch>='0'&&ch <='9')
      printf("It's Number");
      else
      Printf("Please Enter A Valid Character.");
      getch();

      }


Program Analysis :
Here ch is a character type variable and  we use %c to take character type input from terminal or keyboard.If we declare any single character than we must use single quot ( ' ' ).

Then we simply declare our condition through if else if Decision Control Statement and It's done !!!   


Share this article :

Post a Comment

 
Support : Creating Website | Johny Template | Mas Template
Copyright © 2011. Learn Programming - All Rights Reserved
Template Created by Creating Website Published by Mas Template
Proudly powered by Blogger| Distributed by Rocking Templates