Computer Science, asked by pathakshobha300033, 10 months ago

Write a program that will ask the user to enter a character check if it is alphabetic or not. If alphabetic, check whether it is in uppercase or lowercase.

Answers

Answered by vidit05gupta
3

Explanation:

  • Declare a char to input a character.
  • Create a nested if-else to check inserted character is alphabet or not.

Program:

#include <iostream>

#include <string.h>

using namespace std;

int main()

{

   char c;

   

   cout << "Enter a character" << endl;

   cin >> c;

   

   if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))

   {

       cout << "It's an Alphabet." << endl;

       if(c >= 'a' && c <= 'z')

           cout << "Lowercase alphabet.";

       else

           cout << "Uppercase alphabet.";

   }

   else

       cout << "Not an alphabet.";

   

   return 0;

}

#answerwithquality

#BAL

Attachments:
Similar questions