Copy this code in above compiler
- #include<iostream>
- using namespace std;
- int pow(int num,int power)
- {
- int t=num;
- for(int i=1 ; i<power ; i++)
- {
- t*=num;
- }
- return t;
- }
- int main()
- {
- for(int i=1 ; i<=8 ; i++)
- {
- cout<<pow(1,i)<<" "<<pow(2,i)<<" "<<pow(3,i)<<" "<<pow(4,i)<<endl;
- }
- return 0;
- }
Comments and Questions |