0
where is the error i cant able to find out? please someone correct this...
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;
}
+ 7
You are missing <<.
Line 10 after your array <<a[i]" ";
<<a[i]<<" ";
you have << inside a string line 20
"<<r"<< occurs "
"<<r<<"occurs "
+ 2
Thank you Babak Sheykhan (PERS) ... âș
0
magnet mridulkumar160@gmail.com last me fb m themo kook the kl
m hokum c . I'll akwz, Lukoil zs sz