C Programming

C Programming


How To Print V-Shape Pyramid In C

Posted: 25 Sep 2014 12:51 AM PDT

Q. Write a C program to print a V-Shape Pyramid as:

 *   *
  * *
   *

Ans.

/*how to print v-shape pyramid in c*/
#include<stdio.h>
int main()
{
 int num=3,n,r,c,sp,s;
 n=num;
 for(r=1; r<=num; r++,n=n-2)
 {
  for(sp=r; sp>1; sp--)
     printf(" ");
  printf("*");
  for(s=n; s>=1; s--)
     printf(" ");
  if(r<num)
     printf("*");
  printf("\n");
 }
 getch();
 return 0;
}


/************************************************************
The output of above program would be:
*************************************************************/


Output of How To Print V-Shape Pyramid In C
Figure: Screenshot for How To Print V-Shape Pyramid In C

You might also like:
  1. How To Print E-Shape Pyramid In C
  2. How To Print M-shape Pyramid In C
  3. How To Print X-Shape Pyramid In C
  4. Big List of 98+ C Pyramid Programs
  5. Latest 100+ Pyramid Programs list




Post a Comment

ComputerGeek

ComputerGeek


Mysql Database Backup Using PHP / Batch File in Windows System.

Posted: 22 Sep 2014 12:29 AM PDT

Mysql Database Backup Using PHP / Batch File in Windows System. In this section, I will show how to backup Mysql database using php script and batch file(.bat). I had created this script for our client as they require automatic mysql database backup for their project. So You can schedule below script in task schedular of windows system to backup database on daily /monthly basis. Mysql


Post a Comment

9lessons:Facebook Style Notification Popup using CSS and Jquery.

9lessons:Facebook Style Notification Popup using CSS and Jquery.

Link to 9lessons Programming Blog

Facebook Style Notification Popup using CSS and Jquery.

Posted: 11 Sep 2014 09:14 AM PDT

Are you looking for Facebook UI features, this post will explain you how to create a Facebook style notifications popup using Jquery, HTML and CSS, you will understand how CSS elements will helps to improve better web design. This is the most needed feature for social networking web projects to minimize and enrich the UX elements. Just few lines of code implement these concepts in your next project, take a quick look at this live demo.

Facebook Style Notification Popup using CSS and Jquery.

Read more »


Post a Comment

C Programming

C Programming


How To Print M-Shape Pyramid In C

Posted: 03 Sep 2014 10:11 AM PDT

Q. WAP to print M shape pyramid In C language as:

*   *
** **
* * *
*   *
*   *

Ans.

/* how to print m shape pyramid in c*/
#include<stdio.h>
int main()
{

 int num=5,r,c;
 for(r=1; r<=num; r++)
 {
  for(c=1; c<=num; c++)
  {
    if( (c==2 || c==3 || c==4) && (r==1) )
      printf(" ");
    else if( (c==3) && (r==2) )
      printf(" ");
    else if( (c==2 || c==4) && (r==3) )
      printf(" ");
    else if( (c==2 || c==3 || c==4 ) && (r==4 || r==5) )
       printf(" ");
    else
       printf("*");
   }
   printf("\n");
 }
 getch();
 return 0;
}


/**************************************************************
The output of above M Shape pyramid program will be:
**************************************************************/

Output of M-Shape Pyramid In C
Figure: Screenshot for M-Shape Pyramid In C


You might also like:
  1. How To Print E Shape Pyramid Program
  2. Big List of 98+ C Pyramid Programs
  3. Latest Pyramid Programs 100+ List


Post a Comment