Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- int number(int x)
- {
- int a=1, j=0, z=1, g=0;
- while (x>a)
- {
- j=a;
- a+=z;
- z++;
- }
- if(a==x)
- {
- g=1;
- }
- return g;
- }
- using namespace std;
- int main()
- {
- int n, x;
- cin>>n;
- const int N=n;
- int A[N];
- for(int i=0; i<N; i++)
- {
- cin>>x;
- A[i]=number(x);
- }
- for(int i=0; i<N; i++)
- {
- cout<<A[i]<<" ";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement