C Programming Beginner
Page 1 of 1
C Programming Beginner
Find the number of occurrences of the alphabet 'o' in the word "Microsoft" using loop.
#include
using namespace std;
int main()
{ char s[]="Microsoft";
int j,k=0;
for (j=0;s[j]!='t';j++)
{if (s[j]=='o')
k++;
}
cout<<"Occurrence of o ="< system("pause");
return 0;
}
#include
using namespace std;
int main()
{ char s[]="Microsoft";
int j,k=0;
for (j=0;s[j]!='t';j++)
{if (s[j]=='o')
k++;
}
cout<<"Occurrence of o ="<
return 0;
}
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|