Friday 28 July 2017

Number Rhombus Pattern C Program

Q. Write a C program to print the following number rhombus pattern as:


    ********
    ***22***
    **2222**
    *222222*
    22222222
    *222222*
    **2222**
    ***22***
    ********

Ans.

/* c program for number rhombus pattern source code*/
#include<stdio.h>
int main()
{

 int num=3,r,c,x,y,z,sp;
 printf("******\n");
 for(r=1; r<=num; r++)
 {
   for(sp=num-r; sp>=1; sp--)
       printf("*");
   for(c=1; c<=r; c++)
       printf("2");
   for(c=r; c>=1; c--)
       printf("2");
   for(c=num-r; c>=1; c--)
       printf("*");

   printf("\n");
 }
for(r=1; r<num; r++)
 {
   for(sp=r; sp>=1; sp--)
       printf("*");
   for(c=1; c<=(num-r); c++)
       printf("2");
   for(c=num-r; c>=1; c--)
       printf("2");
   for(c=1; c<=r; c++)
       printf("*");
   printf("\n");

 }
 printf("******\n");
 getch();
 return 0;
}


/*************************************
The output of above Number Rhombus Pattern C Program would be:
**************************************/

Intent in Kotlin Android Studio

 Hi larnkoders in this post you are going to learn  about, How to make pass to new activity with information or simply go to new activity on...