#% help
20 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.
the most basic one if for understanding if the number is even or not
#include <iostream>
using namespace std;
int main(){
int even_number = 12,number = 11;
if(even_number%2==0)
cout<<"its even"<<'\n';
if(number % 2 == 0)
cout<<"even"<<'\n';
else
cout<<"not even";
return 0; }```
;compile
its even
not even
it can be used to get the last integer in the number, last 2 integers, so on
it can be done by %10 (in order to get last integer) or %100 (in order to get last 2 integers)
there are a lot of uses, you will understand them after you gain some experience by solving tasks
yes that i want to know
what is its use
2%3 output = 1
but how %100 will work please give an example
for example 1234
1234/100 = 12.34
it will cout<<34
#include <iostream>
using namespace std;
int main(){
cout<<1234%100<<'\n'<<1234%10<<'\n'<<1234/1000;
return 0; }```
;compile
34
4
1
Okkk
This question thread is being automatically closed. If your question is not answered feel free to bump the post or re-ask. Take a look at !howto ask for tips on improving your question.