2024-07-12
한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina
Outputs the following pattern:
* * * * *
* * * * *
* * * * *
* * * * *
* * * * *
- #include <stdio.h>
-
- int main() {
- int n = 5;
- for (int i = 0; i < n; i++) {
- for (int j = 0; j < i; j++) {
- printf(" ");
- }
- for (int k = 0; k < n; k++) {
- printf("* ");
- }
- printf("n");
- }
- return 0;
- }
Code Explanation:
- Output a pattern of asterisks and spaces in the requested format.
- Each line has an increasing number of spaces before the asterisk and a fixed number of asterisks after it.