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

holes:wrong answer..not able to find the reason..pleazzz help!!

$
0
0
#include<stdio.h>
#include<string.h>
int main()
{
int tc,c,i,flag=0;
scanf("%d",&tc);
for(c=0;c<=tc;c++)
{
char str[100];
char *string;
string=gets(str);
for(i=0;i<=strlen(string);i++)
{
if(*(string+i)=='A'||*(string+i)=='D'||*(string+i)=='O'||*(string+i)=='P'||*(string+i)=='R'||*(string+i)=='Q')
      flag++;
else if(*(string+i)=='B')
      flag=flag+2;
}
printf("%d\n",flag);
flag=0;
}
return 0;
}

Viewing all articles
Browse latest Browse all 40121

Trending Articles



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