top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Print the following pattern using C or C++?

+1 vote
408 views
1
4     1
27    8     1
256   81    16   1
3125  1024  143  32   1
posted Jan 7, 2015 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote
#include<stdio.h>
main()
{
    int i,j,k,res=1;
    for(i=1;i<=5;i++)
    {
        for(j=i;j>=1;j--)
        {
            for(k=1;k<=j;k++)
            {
                res = res*j;
            }

            printf("%d ",res);
            res=1;
        }
        printf("\n");
    }
}
answer Jan 8, 2015 by Chirag Gangdev
Similar Questions
–1 vote

Given an ODD number, print diamond pattern of stars recursively.

Example
Input: n = 5,

Output:

  *
 ***
*****
 ***
  *
+2 votes

How will we print numbers from 1 to N without using loop or recursion?

+2 votes

What is the Best Pattern or Topology for avoid Memory Leaks in Projects

...