[solved]-Code Compiles Runs Output Searching Atg Tta Incorrect Please Help Find Wrong Q38995806
![3. [Bonus Problem] DNA Subsequence A DNA sequence is a sequence of some combination of the characters A (adenine), C (cytosin](https://media.cheggcdn.com/media/8fc/s1024x605/8fcc6160-542f-4138-8af5-c637cea75448/phpkILxba.png)
![8 9 10 #include<stdio.h> #include <string.h> #include <stdlib.h> 12 int main( int argc, char *argv[]) { 14 15 16 18 19 ....ch](https://media.cheggcdn.com/media/26a/s642x1024/26aba19e-2533-4a8c-bc7e-b6c38c71e44b/phpy9z9XM.png)
The code compiles and runs but the output when searching for ATGand TTA is incorrect. Please help find what is wrong.
3. [Bonus Problem] DNA Subsequence A DNA sequence is a sequence of some combination of the characters A (adenine), C (cytosine), G (guanine), and T (thymine) which correspond to the four nucleobases that make up DNA. Given a long DNA sequence, it is often necessary to compute the number of instances of a certain subsequence. For this exercise, you will develop a program that processes a DNA sequence from a file and, given a subsequences, searches the DNA sequence and counts the number of times s appears. As an example, consider the following sequence: GGAAGTAGCAGGCCGCATGCTTGGAGGTAAAGTTCATGGTTCCCTGGCCC If we were to search for the subsequence GTA, it appears twice. You will write a program (place your source in a file named dnaSearch.c) that takes, as command line inputs, an input file name and a valid DNA subsequence. That is, it should be callable from the command line as follows: ./dnaSearch dna01.txt GTA GTA appears 2 times What you will submit via handin: dnaSearch.c. 8 9 10 #include<stdio.h> #include <string.h> #include <stdlib.h> 12 int main( int argc, char *argv[]) { 14 15 16 18 19 ….char str[100], sub[10], string[1][100]; int i = 0, 1, 1, 11, 12, count = 0; char dest[100] = { 0 }; if( argc == 3){- …..printf(“n”); } else if ( argc > 3){- printf(“Too many arguments supplied. In”); …} …else { printf(“One argument expected. n”); 22 FILE *file = fopen( argv[1], “r”); … if ( file == 0 ) 28 printf(“Could not open filen”); 33 else . … fscanf( file, “%s”, str); //printf(“File Content: %sn”, str);- … fclose(file); strcpy(sub, argv[2]);- 11 = strlen(str); 12 = strlen( sub); while (i < 11) {- strncpy(dest, str+(i), 12);- ….. i++; 46 47 if(strcpy(dest, sub) == 0){ count++; cm .} printf(“%s occurs %d times n”, sub, count); return 0;- 49 50 } Show transcribed image text 3. [Bonus Problem] DNA Subsequence A DNA sequence is a sequence of some combination of the characters A (adenine), C (cytosine), G (guanine), and T (thymine) which correspond to the four nucleobases that make up DNA. Given a long DNA sequence, it is often necessary to compute the number of instances of a certain subsequence. For this exercise, you will develop a program that processes a DNA sequence from a file and, given a subsequences, searches the DNA sequence and counts the number of times s appears. As an example, consider the following sequence: GGAAGTAGCAGGCCGCATGCTTGGAGGTAAAGTTCATGGTTCCCTGGCCC If we were to search for the subsequence GTA, it appears twice. You will write a program (place your source in a file named dnaSearch.c) that takes, as command line inputs, an input file name and a valid DNA subsequence. That is, it should be callable from the command line as follows: ./dnaSearch dna01.txt GTA GTA appears 2 times What you will submit via handin: dnaSearch.c.
8 9 10 #include #include #include 12 int main( int argc, char *argv[]) { 14 15 16 18 19 ….char str[100], sub[10], string[1][100]; int i = 0, 1, 1, 11, 12, count = 0; char dest[100] = { 0 }; if( argc == 3){- …..printf(“n”); } else if ( argc > 3){- printf(“Too many arguments supplied. In”); …} …else { printf(“One argument expected. n”); 22 FILE *file = fopen( argv[1], “r”); … if ( file == 0 ) 28 printf(“Could not open filen”); 33 else . … fscanf( file, “%s”, str); //printf(“File Content: %sn”, str);- … fclose(file); strcpy(sub, argv[2]);- 11 = strlen(str); 12 = strlen( sub); while (i
Expert Answer
Answer to The code compiles and runs but the output when searching for ATG and TTA is incorrect. Please help find what is wrong…. . . .
OR

