Get Email Subscription

Enter your email address:

Delivered by FeedBurner

Wednesday, April 21, 2010

This is a program to print the Floyds triangle. (C++)


This is a program to print the Floyds triangle.
The program can be modified to print * or any other symbols.
 
#include< stdio.h>
#include< conio.h>
void main()
{
int i,j,k=1,n;
clrscr();
printf("enter the value of n\n");
scanf("%d",&n);
printf("the triangle will be:\n");
for(i=1;i< =n;i++)
{
for(j=0;j;)
{
printf("%d ",k);
k++;
}
printf("\n");
}
getch();
}
 
 
 
 
 
--------------------------------------------------------------------------------
 
 
 
Output: Enter the value of n
            6
            The Triangle will be
            1
            2   3
            4   5   6
            7   8   9
            10 11 12 13
            14 15 16 17 18
 
 

Related Posts by Categories



0 comments:

About This Blog

Lorem Ipsum

  © Blogger templates Newspaper III by Ourblogtemplates.com 2008

Back to TOP