Zoos
Problem
You are required to enter a word that consists of and that denote the number of Zs and Os respectively. The input word is considered similar to word zoo if .
2*x=y
Determine if the entered word is similar to word zoo.
For example, words such as zzoooo and zzzoooooo are similar to word zoo but not the words such as zzooo and zzzooooo.
C Solution:
- #include<stdio.h>
- #include<string.h>
- int main(){
- char s[100];
- int c=0,c1=0;
- scanf("%s",s);
- for(int i=0;i<strlen(s);i++){
- if(s[i]=='z')
- c+=1;
- if(s[i]=='o')
- c1+=1;
- }
- if(c*2==c1)
- printf("Yes");
- else
- printf("No");
- return 0;
- }
Note:
We
Are Providing Every Content in this Blog Inspired From Many People and
Provide it Open To All People Who Are Willing Gain Some Stuff in
Computer Science.
Post a Comment
Post a Comment
Learn, Share and Enjoy