Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 39796

Holes problem

$
0
0
#include<iostream>
using namespace std;
int main()
{
char a[5],i,j,n,count=0;
cout<<"Enter the value of n :";
cin>>n;
cout<<"\n Enter the character ";
for(i=0;i<n;i++)
{
    cin>>a[i];
}
for(i=0;i<n;i++)
{
    cout<<"Charactered entered are :"<<a[i];
}
for(i=0;i<n;i++)
{
    if(a[i]=='A' || a[i]=='D'|| a[i]=='O' || a[i]=='P' || a[i]=='R')
    {
        count+=1;
    }
    if(a[i]=='B')
    {
        count+=2;
    }
}
cout<<"\n Total number of holes in the plane is "<<count;
return 0;
}

can anyone please check this, why this code is not working? specially the input


Viewing all articles
Browse latest Browse all 39796

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>