Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma hdrstop
- #pragma argsused
- #ifdef _WIN32
- #include <tchar.h>
- #else
- typedef char _TCHAR;
- #define _tmain main
- #endif
- #include <stdio.h>
- #include <iostream>
- #include <conio.h>
- using namespace std;
- bool checkForfive(int x,int num, int z)
- {
- int y=1+x;
- while(y>x)
- {
- y=x;
- if (x&1) {
- x = x>>1;x+=z;
- }
- else x=x>>1;
- }
- while (x>0)
- {
- x-=num;
- }
- if(x==0) return 1;
- else return 0;
- }
- int _tmain(int argc, _TCHAR* argv[])
- {
- int x;
- cin >> x;
- cout <<"Answer in boolean algebra if "<<x<<" is divided by 5 : "<<checkForfive(x,5,8)<<endl;
- cout <<"Answer in boolean algebra if "<<x<<" is divided by 29 : "<<checkForfive(x,29,15)<<endl;
- cout <<"Answer in boolean algebra if "<<x<<" is divided by 223 : "<<checkForfive(x,223,112)<<endl;
- getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement