C program that receives a 10 (or n) digit number and print it out in large size with hash symbol

you can print n number of digits with very simple logic and print this number in large size also you can mod the code and print pattern of Digits with  stars or any other special symbol.

  print with custom symbol new post Click Here 

 

 here is "c" code : 

 

  #include<stdio.h>

void num(int num,int x){//all numbers printed from zero to nine

 if(num==1){
    if(x==1)printf("##%2c",32);
    if((x<6&&x>1)||x==0)printf(" #%2c",32);
    if(x==6)printf("###%1c",32);  }

 if(num==2){
    if(x==0||x==3||x==6)printf("#######%2c",32);
    if(x==1||x==2)printf("      #%2c",32);
    if(x==5||x==4)printf("#      %2c",32);  }

if(num==3) {

    if(x==0||x==3||x==6)printf("#######%2c",32);
    if(x==1||x==2||x==5||x==4)printf("      #%2c",32);  }

if(num==4){
    if(x==0||x==1)printf("#%5c",32);
    if(x==2)printf("# #%3c",32);
    if(x==3)printf("####%2c",32);
    if((x>3)&&(x<7))printf("  #%3c",32);}

if(num==5){
    if(x==0||x==3||x==6)printf("######%2c",32);
    if(x==1||x==2)printf("#%7c",32);
    if(x==4||x==5)printf("     #%2c",32);  }

if(num==6){
    if(x==0||x==3||x==6)printf("######%2c",32);
    if(x==1||x==2)printf("#%7c",32);
    if(x==4||x==5)printf("#    #%2c",32);  }

if(num==7){
 if(x==0)printf("#######%2c",32);
 if(x==1)printf("#     #%2c",32);
 if(x==2)printf("      #%2c",32);
 if(x==3)printf("     #%3c",32);
  if(x==4)printf("    #%4c",32);
 if(x==5)printf("    #%4c",32);
  if(x==6)printf("    #%4c",32);
}

if(num==8){
    if(x==0||x==3||x==6)printf(" #### %2c",32);
    if(x==1||x==2||x==4||x==5)printf("#    #%2c",32); }


if(num==9){
    if((x==0))printf(" # # %2c",32);
    if((x==1)||(x==2)||(x==5))printf("#   #%2c",32);
    if((x==3)||(x==6))printf("#####%2c",32);
    if(x==4)printf("    #%2c",32);
         }
if(num==0){
    if(x==0||x==6)printf(" #### %2c",32);
    if((x>0)&&(x<6))printf("#    #%2c",32);
         }
}

void pnum(int t,int *p)//for printing number first print first line of all numbers and so on
{int c;
for(int x=0;x<8;x++){
                     printf("\n "),c=0;
                           while(c<t) num(p[c],x),c++;  }
}

int main()
{  int a[10]={0},t,x;
printf("Enter total Digit count (maximum 10 example: 225 = 3 digit) : ");
scanf("%d",&t);
if(t>10)printf("Try with less number of digit..");
else scanf("%d",&x);

for(int i=t-1;i>=0;i--)a[i]=(x%10),x=x/10;//storing single number in single variable in array

pnum(t,a);//print numbers
}



//if something went wrong or need mod please comment below

1 Comments

  1. thank you sir you help me to solve my question Write a program that receives a number as input and prints it in large size on a same line as shown below in the image.

    ReplyDelete