how can i get this by using for loop?
*
**
*
****
*
******
Answers were Sorted based on User's Feedback
Answer / suman_kotte
int i,j;
for(i=1;i<=3;i++)
{
print("*");
print("\n");
for(j=1;j<=i*2;j++)
print("*");
print("\n");
}
| Is This Answer Correct ? | 14 Yes | 1 No |
#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)
{
for(int j=-2;j<=i;j+=2)
printf("*");
printf("*\n*");
}
getch();
}
thank u
| Is This Answer Correct ? | 1 Yes | 0 No |
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 |
What is the need of structure in c?
Is boolean a datatype in c?
Write a C program that reads a series of strings and prints only those ending in "ed"
How do you define CONSTANT in C?
wap in c to accept n number display the highest and lowest value
# define prod(a,b)=a*b main() { int x=2; int y=3; printf("%d",prod(x+2,y-10)); } the output of the program is a.8 b.6 c.7 d.none
What is c programing language?
program to find which character is occured more times in a string and how many times it has occured? for example in the sentence "i love india" the output should be i & 3.
count the numbers between 100 and 300, that star with 2 and ends with 2
printf(), scanf() these are a) library functions b) userdefined functions c) system functions d) they are not functions
what is the purpose of the code, and is there any problem with it. unsigned int v[10]; unsigned int i = 0; while (i < 10) v[i] = i++;
write a program to display the numbers in the following format 4 4 3 3 3 3 2 2 2 2 2 2 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 2 2 2 2 2 3 3 3 4