#include<stdio.h>
#include<conio.h>
main()
{
int n,i,j; //variable declaration
printf("Enter the number of rows: "); //asking number of rows from user
scanf("%d",&n); //getting number of rows from the user
for(j=1;j<=n;j++) //responsible for values in rows
{
for(i=1;i<=j;i++) //responsible for NUMBER of values in rows
{
printf("%d",j); //printing each row
}
printf("\n"); //jumping to next row
}
getch();
}
Output:
Enter The No of Rows 5
1
22
333
4444
55555
Also see program to find roots of quadratic equation
#include<conio.h>
main()
{
int n,i,j; //variable declaration
printf("Enter the number of rows: "); //asking number of rows from user
scanf("%d",&n); //getting number of rows from the user
for(j=1;j<=n;j++) //responsible for values in rows
{
for(i=1;i<=j;i++) //responsible for NUMBER of values in rows
{
printf("%d",j); //printing each row
}
printf("\n"); //jumping to next row
}
getch();
}
Output:
Enter The No of Rows 5
1
22
333
4444
55555
Also see program to find roots of quadratic equation