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: A number of two digits is lucky if one of its digits is divisible by the other.

For example, 39, 82, and 55 are lucky, while 79 and 43 are not.

Given a number between 10 and 99, determine whether it is lucky or not.

🔗 Problem Link: Codeforces Problem

💡 Solution:

#include <stdio.h>
int main()
{
    int n;
    scanf("%d", &n);
    int a = n / 10;
    int b = n % 10;
    if (a == 0 || b == 0)
    {
        printf("YES");
    }
    else
    {
        if (a % b == 0 || b % a == 0)
            printf("YES");
        else
            printf("NO");
    }
    return 0;
}

✅ This solution reads an integers “n” from user and then find the factorial value of n.

📝 Input:

39

📄 Output:

YES

🔗 Find Similar Problems from CodeforcesClick Here

🤔 More Problem SolvingClick Here

📘 Learn C Programming – Click Here

Related Posts

Leave a Reply

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