+ 2

What is the error in this code..code is in description section...??

#include <iostream> using namespace std; int main() { int a[10] , sum=0 ,i; cout<<"enter 10 elements of array"<<endl; for(i=0;i<10;i++) { cin>>a[i]>>endl ; sum=sum+a[i] } cout<<sum<<endl; return 0; }

17th Jun 2018, 8:57 AM
Kapil Sharma
Kapil Sharma - avatar
2 Answers
+ 12
Don't use endl with cin.
17th Jun 2018, 9:09 AM
Hatsy Rei
Hatsy Rei - avatar
0
thank you Hatsy Rei
18th Jun 2018, 7:06 AM
Kapil Sharma
Kapil Sharma - avatar