Write a program to obtain a number (N) from the user and display whether the number is a one digit number, 2 digit number, 3 digit number or more than 3 digit number

 

Write a program to obtain a number (N) from the user and display whether the number is a one digit number, 2 digit number, 3 digit number or more than 3 digit number






OURSHOPKEEPER








#include <iostream>
using namespace std;
int main()
{
    int Ncount = 0digit;

    cin >> N;
    while (N > 0)
    {
        digit = N % 10;
        N = N / 10;
        count++;
    }
    if (count == 1)
    {
        cout << "1";
    }
    else if (count == 2)
    {
        cout << "2";
    }
    else if (count == 3)
    {
        cout << "3";
    }
    else
        cout << "More than 3 digits";
}






    


Click on the above button to download the code.



Post a Comment

If you have furthur QUERIES please let us know

Previous Post Next Post