c++ program - to enter a number check whether it is divisible by 100 or not
Answers
Answered by
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
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:
- START
- Take the number as input.
- Check if the number is divisible by 100 or not and display the result accordingly.
- STOP
Note: To find the remainder, %(modulo) operator is used.
Refer to the attachment.
Attachments:
Similar questions