Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // In DNA strings, symbols "A" and "T" are complements of each other, as "C" and "G". You have function with one side of the DNA (string, except for Haskell); you need to get the other complementary side. DNA strand is never empty or there is no DNA at all (again, except for Haskell).
- // Example: (input: output)
- // dna_strand("ATTGC") /* return "TAACG" */
- // dna_strand("GTAT") /* return "CATA" */
- #include <stdlib.h>
- #include <string.h>
- char *dna_strand(const char *dna)
- {
- char *out;
- unsigned idx;
- out = calloc(1, strlen(dna) + 1);
- for(idx = 0; dna[idx]; ++idx)
- out[idx] = (2652 / (11 * dna[idx] - 703) + 703) / 11;
- return out;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement