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

What's the best way of making my program efficient?

0 Answers   Celstream,


When do you say that a digraph is acyclic A)if and only if its first search does not have back arcs B)a digraph is acyclic if and only if its first search does not have back vertices C)if and only if its first search does not have same dfnumber D)None of these

1 Answers   Accenture, IBM,


Write an algorithm for a program that receives an integer as input and outputs the product of of its digits. E.g. 1234 = 24, 705 = 0

4 Answers  


Explain what are the different data types in c?

0 Answers  


Write a function in c to find the area of a triangle whose length of three sides is given.

2 Answers  






Which are low level languages?

0 Answers  


How to write a code for reverse of string without using string functions?

0 Answers   TCS,


How do you define CONSTANT in C?

0 Answers   ADP,


Explain the meaning of keyword 'extern' in a function declaration.

0 Answers  


List the difference between a While & Do While loops?

0 Answers   Accenture,


ATM machine and railway reservation class/object diagram

0 Answers   Zycus Infotech,


main() { printf(5+"Vidyarthi Computers"); }

6 Answers  


Categories