I mean that the following codes should have the same output, but a change of line is giving a whole different output. I'm using Turbo C++ compiler, I know that these codes are outdated but in my exams only these are going to come.
Code 1
#include<iostream.h>
#include<conio.h>
void main()
{clrscr();
int i,j;
for(i=1;i<=5;i++)
{for(j=1;j<i;j++)
cout<<"*";
cout<<"\n";
}
getch();}
and this one-
Code-2
#include<iostream.h>
#include<conio.h>
void main()
{clrscr();
int i,j;
for(i=1;i<=5;i++)
{for(j=1;j<i;j++)
cout<<"*"<<"\n";
}
getch();}
Output 1-
*
**
***
****
Output 2-
*
*
*
*
*
*
*
*
*
*
Code 1
#include<iostream.h>
#include<conio.h>
void main()
{clrscr();
int i,j;
for(i=1;i<=5;i++)
{for(j=1;j<i;j++)
cout<<"*";
cout<<"\n";
}
getch();}
and this one-
Code-2
#include<iostream.h>
#include<conio.h>
void main()
{clrscr();
int i,j;
for(i=1;i<=5;i++)
{for(j=1;j<i;j++)
cout<<"*"<<"\n";
}
getch();}
Output 1-
*
**
***
****
Output 2-
*
*
*
*
*
*
*
*
*
*