Advertisement
sidex15

2/14/2019 C++ exercise #1

Feb 14th, 2019
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. #include<iostream.h>
  2. #include<conio.h>
  3. #include <math.h>
  4.  
  5. int main()
  6. {
  7. int a,b[100];
  8. clrscr();
  9. cout<<"input a number: ";
  10. cin>>a;
  11. for(int k=0;k<a;k++){
  12.  cin>>b[k];
  13. }
  14. for(int i=0;i<a;i++){
  15.  b[i]=pow(b[i],2);
  16.  if(b[i]%2==0){
  17.   cout<<b[i]<<" is divisible by 2";
  18.  }
  19.  else{
  20.   cout<<b[i]<<" is not divisible by 2";
  21.  }
  22.  cout<<"\n";
  23. }
  24. getch();
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement