+ 3
#include <stdio.h> int main() { int a[5]={1,2,3,5,8}; int first,second =0; for(int i=0;i<=4;i++) { if (a[i]>first ) {
what is wrong in this code?
5 Antworten
+ 5
Hello, IShiva SHreya !
Please attach your code here, Sololearn has this option. And then people can help you!
+ 3
first is not initialised , and u r using it to compare with a[i] , it will pick any garbage value and compare it with a[i].
+ 3
Here is your error free code
https://code.sololearn.com/ctETibNLTrU9/?ref=app
+ 3
I more suggestion IShiva SHreya
for the next time try to post the question above and your doubt in description section,
and try to post codes in playground section and link them here.
Happy coding ✌🏻
0
thanks :)