Answers for "there is a string, , of lowercase english letters that is repeated infinitely many times. given an integer, , find and print the number of letter a's in the first letters of the infinite string."

0

there is a string, , of lowercase english letters that is repeated infinitely many times. given an integer, , find and print the number of letter a's in the first letters of the infinite string.

#inlcude <stdio.h>
/*  I suppose the string is in some kind of file so you just need
	to run your executable with the input coming from that file.
    It can be done by this command:
    ./[executable file] < [input file] */

/*  About the integer that you are being given since is not
	quite clarified how to insert it you can just change
    it from inside the program */

int main(){
	char c;
    int i = 0;
    int x = 10; /* Change x in the desired value */
    
    while( ((c=getchar())!=EOF) && (i<x)){
    	if(c=='a') putchar(c);
        i++;
	}
    
    return 0;
}
Posted by: Guest on March-18-2022

Code answers related to "there is a string, , of lowercase english letters that is repeated infinitely many times. given an integer, , find and print the number of letter a's in the first letters of the infinite string."

Browse Popular Code Answers by Language