Hi iman,
I tried to make triangle as you want , but due to less time i have only created it for increment part. Check code and output below.
#include <stdio.h>
#include <conio.h>
void main(){
int i,j,num,c=1,d=2,n=1;
clrscr();
printf("*****FLOYD'S TRIANGLE*****\n\n");
printf("Enter number upto which u want to generate : ");
scanf("%d",&num);
for(i=c;i<=num;){
c=1;
d=2;
for(j=1;j<=i;j++){
if(n == 1)
{
printf("%5d ",c);
c = c+2;
}
if(n == 0)
{
printf("%5d ",d);
d = d + 2;
}
if(c > num || d > num)
{
goto out;
}
}
printf("\n");
if(n == 1)
n = 0;
else
n = 1;
if(n == 1)
i++;
}
out:
getch();
}
Output
1
2
1 3
2 4
1 3 5
2 4 6
I will try for the decrement part when i will get time.
Hope this helps you.