Whats wrong here ? Why the code output prints some extra lines?
Input:line number=n.
Enter number=num.If line=4 and num=2
, the output will be....
2
4
8
16

My code is....

#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
	int n,num,i,j,s=1,m;
	cin>>n>>num;
	for(i=1;i<=n;i++)
		{
			m=1;
		while(s<=j){
			m=num*m;
			s++;
		}
		cout<<m;
		cout<<endl;
	}
		
		getch();
		return 0;
}
while(s<=j){

You haven't initialized j before in your code.

while(s<=j){

You haven't initialized j before in your code.

Yes. Always, always read your compiler warnings! They are trying to tell you something, and very rarely should you ignore them.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.