1. Welcome to PHCorner Forums. Take a moment to Sign up and gain unlimited access and extra privileges that guests are not entitled to, such as:

    All that and more! Registration is quick, simple and absolutely free. Join our community today!

C and C++ Square and Cube a #

Discussion in 'Coding, Programming' started by Avincent, May 3, 2016.

  1. Basic C/C++

    code:

    #include <iostream>
    #include <conio.h>

    using namespace std;

    int main(){

    int num;
    int prod;
    int sqrt;
    int cube;

    cout<<"Enter A Number: ";
    cin>>num;

    cout<<"\nn"<<"\tn*2"<<"\tn^2"<<"\tn^3\n"<<endl;

    for (int i=1; i<=num; i++)
    {

    prod= i*2;
    sqrt= i*i;
    cube= i*i*i;

    cout<<i;

    cout<<"\t"<<prod;


    cout<<"\t"<<sqrt;


    cout<<"\t"<<cube<<endl;




    }

    getch();
    return 0;

    }
     
  2. lenka08

    lenka08 Enthusiast Established

    error sa <iostream>?
     
Tags / Keywords: