Created
October 31, 2018 20:39
-
-
Save onsah/2993902489ff555952d3605f4956c8ec to your computer and use it in GitHub Desktop.
Ödev
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
void print_pairs(const char *nucleotides, int len) | |
{ | |
int count = 0; | |
for (int i = 0; i < len; ++i) { | |
if (nucleotides[i] == nucleotides[i + 1]) { | |
count += 1; | |
printf("%c%c\n", nucleotides[i], nucleotides[i]); | |
} | |
} | |
printf("%i consecutive nucleobases\n", count); | |
} | |
int main() | |
{ | |
char nucleotides[1000]; | |
int len; | |
scanf("%d", &len); | |
scanf("%s", nucleotides); | |
print_pairs(nucleotides, len); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment