+ 1

Can anyone check the program below ? I want values to be enter by user but after entering the loop it won't let the values to be

#include<stdio.h> #include<conio.h> int main() { int a[100]; int n, max, k; printf("enter the size of array:"); scanf("%d", &max); printf("enter the elements you want to enter\n"); max==a[n]; n=n+1; for(n=0; n<=max; n++) printf("a[%d] is \n ",n); scanf("%d", &a[n]); for(n=0; n<=max; n++) printf("entered elements are a[%d] is %d\n",n,a[n]); getch(); }

22nd Mar 2020, 1:24 PM
Gagan Gupta
Gagan Gupta - avatar
4 Réponses
+ 1
What is that you are trying to achieve from the code you shared. Do you just want to take user input, store them in an array and display them? Or is it something different?
22nd Mar 2020, 2:09 PM
Avinesh
Avinesh - avatar
+ 1
Can you explain what you expected from the code? I mean what it should take and what output was expected.
22nd Mar 2020, 2:09 PM
Ipang
0
Plz everyone be sure to review this post
22nd Mar 2020, 1:25 PM
Gagan Gupta
Gagan Gupta - avatar
0
I don't understand what max==a[n] and next line are supposed to do and I think it's unnecessary. For sure you need braces in both for loops.
22nd Mar 2020, 1:41 PM
Aleksandra Krawiec
Aleksandra Krawiec - avatar