Table of Contents
In this article, we will discuss Floyd’s triangle number Pattern in C Language using for loop
In this post, we are going to learn how to create Floyd’s triangle number pattern using for loop
Program 4
#include <stdio.h>
#include <stdlib.h>
int main()
{
int i,space,rows,k=0, count=0,count1=0;
printf(“Enter number of rows:n”);
scanf(“%d”,&rows);
for(i=1; i<=rows; ++i)
{
for (space=1; space<=rows-i; ++space)
{
printf(” “);
++count;
}
while(k!=2*i-1)
{if(count<=rows-1)
{
printf(“%d”,i+k);
++count;
}
else
{
++count1;
printf(“%d”,(i+k-2*count1));
}
++k;
}
count1=count=k=0;
printf(“n”);
}
return 0;
}
Multiply two numbers in Java using scanner| 5 different ways In this article, we will…
5 Different ways to Divide two numbers in Java using scanner In this article, we…
Learn 8 Ways to Subtract Two Numbers Using Methods in Java In this article, we…
10 ways to subtract two numbers in Java In this article, we will discuss the…
Java Code Examples – Multiply Two Numbers in 5 Easy Ways In this article, we…
How to Divide two numbers in Java| 5 different ways In this article, we will…
This website uses cookies.