Wednesday, 5 November 2014

Write a program that accepts a character and determine either the character is a lowercase letter or uppercase letter.

Leave a Comment


Code in C:


#include <stdio.h>
#include <stdlib.h>
int main()
{
    char alfa;
    int result=0;
    printf("Enter any Alfabet = ");
    scanf("%c",&alfa);
    result=(int)alfa;
    if(result==65||result<91)
    {
        printf("%c is Capital letter\n",alfa);
    }
    else if(result==97||result<123)
        {
        printf("%c is Small letter\n",alfa);
        }
    return 0;
}


Code in C ++:

#include<iostream>
#include<conio.h>
using namespace std;
void main()
{
char value;
int result=0;
cout<<"Enter any alfabet = ";
cin>>value;
result=(int)value;
    if(result==65||result<91)
    {
        cout<<value<<" is Capital letter\n";
    }
    else if(result==97||result<123)
        {
        cout<<value<<" is Small letter\n";
        }
getch();
}

Output:



If You Enjoyed This, Take 5 Seconds To Share It