Computer Science, asked by dsudhao, 4 months ago

c++ program - to enter a number check whether it is divisible by 100 or not​

Answers

Answered by RvP10
1

Answer:

#include <bits/stdc++.h>

using namespace std;

int main() {

int n;

cin>>n;

if(n%100==0)

cout<<" DIVISIBLE BY 100";

else

cout<<" NOT DIVISIBLE BY 100";

}

Answered by anindyaadhikari13
2

Required Answer:-

Question:

  • Write a C++ program to enter a number and check whether it is divisible by 100 or not.

Solution:

Here is the program.

#include <iostream>

using namespace std;

int main()

{

   int n;

   cout << "Enter an integer: ";

   cin >> n;

   if ( n % 100 == 0)

       cout << n << " is divisible by 100.";

   else

       cout << n << " is not divisible by 100.";

   return 0;

}

Algorithm:

  1. START
  2. Take the number as input.
  3. Check if the number is divisible by 100 or not and display the result accordingly.
  4. STOP

Note: To find the remainder, %(modulo) operator is used.

Refer to the attachment.

Attachments:
Similar questions