a basic program whose output will be☝☝
pls use nested loop
pls fast
Attachments:
preeja13:
please answer fast
Answers
Answered by
0
IN JAVA,
import java.util.*;
class np9
{
public static void main(String args[])
{
int i,j,n,k;
Scanner sc = new Scanner(System.in);
System.out.println("Enter the no of lines");
n=sc.nextInt();
for(i=1;i<=n;i++)
{
k=i;
for(j=1;j<=i;j++,k++)
{
System.out.print(k);
}
System.out.println("");
}
}
}
IN C++,
#include
int main()
{
int i, j;
for (i=1; i<=5; ++i)
{
for (j=1; j<=i; ++j)
{
printf("%2d", i+j-1);
}
printf("\n");
}
return 0;
}
HERE IS YOUR ANSWER...
HOPE IT HELPS! ^_^
import java.util.*;
class np9
{
public static void main(String args[])
{
int i,j,n,k;
Scanner sc = new Scanner(System.in);
System.out.println("Enter the no of lines");
n=sc.nextInt();
for(i=1;i<=n;i++)
{
k=i;
for(j=1;j<=i;j++,k++)
{
System.out.print(k);
}
System.out.println("");
}
}
}
IN C++,
#include
int main()
{
int i, j;
for (i=1; i<=5; ++i)
{
for (j=1; j<=i; ++j)
{
printf("%2d", i+j-1);
}
printf("\n");
}
return 0;
}
HERE IS YOUR ANSWER...
HOPE IT HELPS! ^_^
Similar questions