0

where is the error i cant able to find out? please someone correct this...

https://code.sololearn.com/cZk7idv09y9u/?ref=app

13th Apr 2018, 3:41 PM
ARIF ANSARI
ARIF ANSARI - avatar
4 Answers
+ 4
Major problems: 1. if(I=r). It's a common mistake! Even for best of us, so don't worry! 2. uninitialized variable "c". Don't count on compiler to make it zero for you. It's a hell of garbage! The following works fine. Minor problems: 1. Your code is ugly as hell my friend! (just kidding) :D If you care a little bit to indentation and whitespace, then every thing is good to go #include <iostream> using namespace std; int main() { int a[10]={6,6,6,3,5,6,7,5,4,33}; int i,r=6,c=0; cout<<"suppose these are the list of no.s"; for(i=0;i<10;i++){ cout<<a[i]<<" "; } for(i=0;i<10;i++){ if(i==r) { c++; } } cout<<"\n "<<r<<" occurs "<<c<<" times"; return 0; }
13th Apr 2018, 4:54 PM
Babak
Babak - avatar
+ 7
You are missing <<. Line 10 after your array <<a[i]" "; <<a[i]<<" "; you have << inside a string line 20 "<<r"<< occurs " "<<r<<"occurs "
13th Apr 2018, 3:52 PM
Toni Isotalo
Toni Isotalo - avatar
+ 2
Thank you Babak Sheykhan (PERS) ... â˜ș
13th Apr 2018, 5:31 PM
ARIF ANSARI
ARIF ANSARI - avatar
0
magnet mridulkumar160@gmail.com last me fb m themo kook the kl m hokum c . I'll akwz, Lukoil zs sz
14th Apr 2018, 1:52 PM
mridul kumar