Created
October 28, 2017 09:28
-
-
Save unaipme/01eed4ff6cfe03854895d5d2731133b6 to your computer and use it in GitHub Desktop.
"I" letra bat erabiltzaileak esandako tamainarekin sortzen duen programa, 2 "for" bakarrik erabiltzen
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
int n, x, y, xTope; | |
printf("Sartu zenbakia: "); | |
scanf("%d", &n); | |
xTope = (n % 2 == 0) ? (n + 1) : (n); | |
for (y = 0; y < n; y++) { | |
for (x = 0; x < xTope; x++) { | |
if (y == 0 || y == n - 1 || x == n / 2) | |
printf("* "); | |
else | |
printf(" "); | |
} | |
printf("\n"); | |
} | |
getchar(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment