Computing GC Content

Foundational GC Content DNA Statistics
Significance:
GC content correlates with genome stability, melting temperature (Tm) of DNA duplexes, and even organism ecology (thermophiles tend to have GC-rich genomes because G–C pairs have 3 hydrogen bonds vs. 2 for A–T, making them more heat-stable). It's a mandatory field in PCR primer design software and genome-assembly QC reports.
Statement

Given a DNA string, compute its GC content as a percentage: `(count(G) + count(C)) / length × 100`, rounded to exactly 2 decimal places.

Sample Input
CCACCCTCGTGGTATGGCTAGGCATTCAGGAACCGGAGAACGCTTCAGACCAGCCCGGACTGGGAACCTGCGGGCAGTAGGTGGAAT
Sample Output
60.92
Constraints

- `1 ≤ length(DNA) ≤ 1000`
- Round using standard "round half to even" or "round half up" — test cases avoid the ambiguous .005 boundary, so either is fine


My Notes
Log in to save personal notes.
Console output will appear here when you click Run Code or Submit...
Enter DNA / RNA / Protein test string
Next Problem
Hamming Distance (Point Mutation Counting)