0
Error
Whatâs wrong with this code in c language #include <conio.h> #include <stdio.h> int main() { int i,n,j; printf("enter a number"); scanf("%d",&n); for (i=0;i<n;i++) { for(j=0;j<n;j++) if(i==0 || j==0 || i==n-1 || j==n-1 || j+i==n-1) printf("*"); else printf(" "); return 0; } It said error:unpaired curly brackets.
3 RĂ©ponses
+ 8
Saba I already fixed your previous code have an look here
https://code.sololearn.com/cdVy8U02Cpr5/?ref=app
it's same as that problem
int main()
{
// n denotes size which should be odd
int i, j, n;
scanf("%d", &n);
// Function calling
//pattern(n);
for (int i = 0; i < n; i++) {
// Loop denoting columns
for (int j = 0; j < n; j++) {
// Checking boundary conditions and main
// diagonal and secondary diagonal conditions
if (i == 0 || j == 0 || i == j || i == n - 1 || j == n - 1 || i + j == n - 1)
printf("*");
else
printf(" ");
}
printf("\n");
}
return 0;
}
+ 1
after for loop you opend a curly bracket but you didnt close it
by the way your program doesnt need conio.h header file
0
In your code, there were 2open braces & 1 closed brace
Add 1closed curly brace at the end