A simple c program to make the following figure ….
4:29 PM Edit This 2 Comments »543212345
  4321234
    32123
      212
        1
code
=====
#include<stdio.h>
#include<conio.h>
main(){
int p,q,i,j,k;
q=9;
for(i=1;i<=5;i++){
                  for(j=q;j>=i;j--){
                                    if(j>4){
                                            p=j-4;
                                            printf("%d",p);
                                            }
                                    if(j<=4){
                                             p=p+1;
                                             printf("%d",p);
                                    }
                  }
                  printf("\n");
                  for(k=1;k<=i;k++){
                                    printf(" ");
                                    }
                  q=q-1;
                  }
getch();
} 
-tested in dev c++ runiing on win7 & gcc compiler.
-it is a user independent code.anyone can make it user dependent easily.
-thanks to Mr.Saikat Chakraborty & Mr.Monish Chatterjee.
2 comments:
u think me fool?
what kind of code is this ?
Post a Comment