Advertisement
DarthLucius

Print Squares and Cubes-8532

Mar 5th, 2020
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.30 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4. int main () {
  5.     int a,b;
  6.     cin>>a>>b;
  7.     if(0<=a&&a<=b&&b<=10000){
  8.     for(long long int i=a;i<=b;i++){
  9.         cout<<pow(i,2)<<" ";
  10.     }
  11.     cout<<endl;
  12.     for (long long int j=b;j>=a;j--){
  13.         cout<<pow(j,3)<<" ";
  14.     }
  15.   }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement