Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

What is wrong with my code? The 1st loop of taking I/P won't terminate.

+1 vote
asked Nov 2, 2022 by Ansharah Sameen (130 points)
#include <stdio.h>
#include <conio.h>

void main ()
{
  int n[5][5],i,k;
  for (i = 0; i <5; i++)
  {
     for (k=0;k < 5;k++)
     {
         printf("Enter a value:");
         scanf("%d",&n[i][k]);
     }
  }
 for (i = 0; i <5; i++)
  {
     for (k=0; k<5; k++)
     {
         printf("n[%d]{%d]=%d\t",i,k,n[i][k]);
     }
     printf("/n");
  }
}

1 Answer

0 votes
answered Nov 4, 2022 by Peter Minarik (84,720 points)
Your program runs and does what it's told to do: read the values into the n array 25 times.

Then print it.

Though the printing is probably malformatted: { vs [.

Also, the newline character is '\n', not "/n".
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...