what is the code for getting the output as
*
**
***

Answers were Sorted based on User's Feedback



what is the code for getting the output as * ** ..

Answer / babitha

# include <Stdio.h>
# include <conio.h>
# include <string.h>

void main()
{
int j,i,n;

scanf("%d",&n);

for (i=0;i<=n;i++)
{
for(j=0;j<i;j++)
printf("*");
printf("\n");
}

getch();

}

Is This Answer Correct ?    6 Yes 1 No

what is the code for getting the output as * ** ..

Answer / gg

#include<stdio.h>
main()
{
int n,i=0,j=0;
printf("Enter an intger : ");//upto n nof *'s
scanf("%d",&n);
while(j<n)
{
for(i=0;i<=j;printf("*"),i++);
printf("\n",j++);
}
}

Is This Answer Correct ?    2 Yes 0 No

what is the code for getting the output as * ** ..

Answer / anvesh

main()
{
printf("*\n**\n***);
}
OR
main()
{
int n,i;
while(n<3)
{
i=0;
while(i<=n)
{printf("*");i++;}
printf("\n); n++;
}

Is This Answer Correct ?    4 Yes 3 No

what is the code for getting the output as * ** ..

Answer / sourisengupta

void main()
{
int i,j;
for(i=0;i<3;i++){
for(j=0;j<i;j++){
printf("*");
printf("\n");
}
}
}

Is This Answer Correct ?    1 Yes 4 No

what is the code for getting the output as * ** ..

Answer / pooja sonawane

void main()
{
int i,j;
for(i=0;i<3;i++)
printf("\n");
for(j=0;j<i;j++)
printf("*");
}

Is This Answer Correct ?    2 Yes 6 No

Post New Answer

More C Interview Questions

a linearly ordered set of data elements that have the same structure and whose order is preserved in storage by using sequential allocation a) circular b) ordinary c) array d) linear list

0 Answers  


What are the advantages and disadvantages of a heap?

0 Answers  


You have an array of n integers, randomly ordered with value 1 to n-1.The array is such that there is only one and one value occurred twice. How will you find this number?

1 Answers  


what is c language?

2 Answers  


Why is c used in embedded systems?

0 Answers  






What are valid operations on pointers?

0 Answers  


What is c mainly used for?

0 Answers  


write a program to arrange the contents of a 1D array in ascending order

4 Answers  


A program is required to print your biographic information including: Names, gender, student Number, Cell Number, line of study and your residential address.

0 Answers  


I need a sort of an approximate strcmp routine?

0 Answers  


Is c a great language, or what?

0 Answers  


Why does not c have an exponentiation operator?

0 Answers  


Categories