Skip to content
Snippets Groups Projects
Commit 36463c97 authored by SATHISH P's avatar SATHISH P
Browse files

also already pratices now only i commit that

parents
No related branches found
No related tags found
No related merge requests found
File added
#include <stdio.h>
int main()
{
int lines;
printf("How many lines to print? ");
scanf("%d", &lines);
int spaces = lines - 1;
for(int i=1, count=0; count<lines; i=i+2, count++, spaces--)
{
for(int s=0; s<spaces; s++)
{
printf(" ");
}
for(int j=0; j<i ; j++)
{
printf("*");
}
printf("\n");
}
}
#include <stdio.h>
int main() {
int numRows, row, column;
printf("Enter the number of lines: "); // user can deside how may lines printing the halfpyramid.
scanf("%d", &numRows);
// Loop for each row.
for(row = 0; row < numRows; row++) {
// Loop for each column in the current row.
for(column = 0; column <= row; column++) {
printf("* ");
}
printf("\n");
}
return 0;
}
#include <stdio.h>
int main() {
int numRows, i, j;
printf("Enter the number of alphabet words to print: ");
scanf("%d", &numRows);
// Loop for each row
for(i = 1; i <= numRows; i++) {
// Loop for each alphabet word in the current row
for(j = 1; j <= i; j++) {
printf("%c ", i + 64);
}
printf("\n");
}
return 0;
}
#include <stdio.h>
int main() {
int numRows, row, column;
printf("Enter the number of lines: ");
scanf("%d", &numRows);
// Loop for each row
for(row = numRows; row > 0; row--) {
// Loop for each number in the current row
for(column = 1; column <= row; column++) {
printf("%d ", column);
}
printf("\n");
}
return 0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment