c++ programming tutorials | education | education international | university | TOP WORLD UNIVERSITY 2014 |education wold
Tuesday, 28 January 2014
print triangle useing 1,2,3..
#include<stdio.h>
int main()
{
int num,r,c,sp;
printf("\tthis code made by hamza on letsdoprogramminginc.blogspot.com\n");
printf("Enter max number : ");
scanf("%d", &num);
for(r=0; r<=num; r++)
{
for(sp=r; sp<num; sp++)
printf(" ");
for(c=r; c>=0; c--)
printf("%d",c);
for(c=1; c<=r; c++)
printf("%d",c);
printf("\n");
}
getch();
return 0;
}
related program
out put is :
*This program written in C Language*/
#include
main()
{
char i,j,k;
for(i='G';i>='A';i--)
{
for(j='A';j<=i;j++)
{
printf("%c",j);
}
for(k=i;k>='A';k--)
{
printf("%c",k);
}
printf("\n");
}
}
Subscribe to:
Post Comments (Atom)
A B C D E F F E D C B A
A B C D E E D C B A
A B C D D C B A
A B C C B A
A B B A
A A