Create the number pattern using C beginner's level
Hey guys once again welcome to the Decoders blog, I hope you all are doing well and today I'm present with another logic but this time with something different it is a C logic which will help us to print a beautiful pattern using C language.
Here is the pattern that we are trying to print
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
and so on upto n number of rows
Here is the code for the given pattern which you can use
#include<stdio.h>
int main()
{
int n;
printf("Enter the value of n-");
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
for(int j=1;j<=i;j++)
{
printf("%d ",j);
}
printf("\n");
}
return(0);
}
Comments
Post a Comment