For文でのエラーについて

前提

GitHubの学習中で、For文を用いたコードを書いています。
For文を用いているとエラーが発生しました

実現したいこと

  • 高さと幅がnの#を出力したいです(そのためにFor文を用いています)

発生している問題・エラーメッセージ

mario.c:13:3: error: expected identifier or '(' for (int i = 0; i < n; i++) ^ 1 error generated. make: *** [<builtin>: mario] Error 1

該当のソースコード

#include <cs50.h> #include <stdio.h> int main(void) { int n; do { n = get_int("write the height of pyramid (integer number more than 0 and less than 9): "); } while (n>=9 || n<=0); } for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { printf("#"); } printf("\n"); }

試したこと

;や()前後の空白等確認しましたがエラーが改善させませんでした。

補足情報(FW/ツールのバージョンなど)

Windowsを利用しています

コメントを投稿

0 コメント