how can i get this by using for loop?
*
**
*
****
*
******

Answer Posted / vignesh1988i

sorry folks, a small mistake in above program , the below is the correct one's...........


#include<stdio.h>
#include<conio.h>
void main()
{
int m;
clrscr();
printf("enter the lines :");
scanf("%d",&m);
for(int i=1;i<=m;i+=2)
{
printf("*");
for(int j=-2;j<=i;j+=2)
printf("*");
printf("*\n");
}
getch();
}


thank u

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

writ a program to compare using strcmp VIVA and viva with its output.

1530


What are preprocessor directives in c?

643


Why do we use namespace feature?

588


Is array a primitive data type in c?

584


write a c program thal will find all sequences of length N that produce the sum is Zero, print all possible solutions?

2415






Differentiate between a for loop and a while loop? What are it uses?

677


What are enumerated types?

657


What is the difference between pure virtual function and virtual function?

656


What is the difference between typedef and #define?

552


How do you convert a decimal number to its hexa-decimal equivalent.Give a C code to do the same

654


illustrate the use of address operator and dereferencing operator with the help of a program guys plzzz help for this question

1590


How can I recover the file name given an open stream?

556


What are the preprocessor categories?

641


What is difference between arrays and pointers?

586


Why void main is used in c?

564