Problem Solving Using C

🔍 Problem Solving from Codeforces using C language

This is a problem-solving post from Codeforces. Below is the problem with a short explanation and its solution.

This example is solved using C language.

🧩 Main Problem: Given a letter X. If the letter is lowercase print the letter after converting it from lowercase letter to uppercase letter. Otherwise print the letter after converting it from uppercase letter to lowercase letter

Note : difference between ‘a’ and ‘A’ in ASCII is 32 .

🔗 Problem Link: Codeforces Problem

💡 Solution:

#include<stdio.h>
int main()
{
    char x;
    scanf("%c", &x);
    if (x>='0' && x<='9') printf("IS DIGIT");
    else if (x>='a' && x<='z') printf("ALPHA\nIS SMALL");
    else if (x>='A' && x<='Z') printf("ALPHA\nIS CAPITAL");
    return 0;
}

✅ This solution reads four integers from user and calculate using the given equation.

📝 Input:

a

📄 Output:

A

📝 Input:

A

📄 Output:

a

🔗 Find Similar Problems from CodeforcesClick Here

🤔 More Problem SolvingClick Here

📘 Learn C ProgrammingClick Here

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *