Answer to Question #48227 in C for keerthana

Question #48227
c program that reads positive integer n & print the following pattern
**********
-*********
--********
---*******
----******
-----*****
------****
-------***
--------**
---------*
1
Expert's answer
2014-10-28T01:42:18-0400
/* Answer on Question#48227 - Subject - Programming, C */
#include <cstdlib>
#include <iostream>
using namespace std;
int main()
{
int nn=0, n, k;
int i,d,a;
printf("enter positive n- number: ");
scanf("%d",&n);
k = n;
for (i=0; i<n; i++)
{
for (d=0; d<nn; d++)
printf("-");

for (a=k; a>0; a--)
printf("*");

k--;
nn++;
printf("\n");
}

system("PAUSE");
return EXIT_SUCCESS;
}


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS