Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hello. We are having a bit of a problem with our program. We aretrying to merge

ID: 3615240 • Letter: H

Question

Hello. We are having a bit of a problem with our program. We aretrying to merge three string arrays into one single. This is thecode of our program and what it should be outputting: 1.#include <stdio.h> 2.#include <string.h> 3. 4. 5.int main() { 6. 7. char str[4]={'T', 'C', 'A', 'G'}; 8. int i,j,k; 9. 10. for (i=0; i<4; i++) { 11. for (j=0; j<4; j++) { 12. for (k=0; k<4; k++) { 13. printf("%c%c%c",str[i],str[j],str[k]);    14. } 15. } 16. } 17. 18. return 0; 19. }
output:TTT TTC TTA TTG TCT TCC TCA TCG TAT TAC TAA TAG TGT TGCTGA TGG CTT CTC CTA CTG CCT CCC CCA CCG CAT CAC CAA CAG CGT CGC CGACGG ATT ATC ATA ATG ACT ACC ACA ACG AAT AAC AAA AAG AGT AGC AGA AGGGTT GTC GTA GTG GCT GCC GCA GCG GAT GAC GAA GAG GGT GGC GGAGGG
On line thirteen notice that we have the statement"str[i],str[j],str[k]". We would like to put that into a singlearray like bigstr[64][3]. Thats the idea. Every single tripley thatyou see in the output, we would like to store that into one singlearray to still produce the same output but with a single arraycomposed with those three string arrays. Is that possible? 1.#include <stdio.h> 2.#include <string.h> 3. 4. 5.int main() { 6. 7. char str[4]={'T', 'C', 'A', 'G'}; 8. int i,j,k; 9. 10. for (i=0; i<4; i++) { 11. for (j=0; j<4; j++) { 12. for (k=0; k<4; k++) { 13. printf("%c%c%c",str[i],str[j],str[k]);    14. } 15. } 16. } 17. 18. return 0; 19. }
output:TTT TTC TTA TTG TCT TCC TCA TCG TAT TAC TAA TAG TGT TGCTGA TGG CTT CTC CTA CTG CCT CCC CCA CCG CAT CAC CAA CAG CGT CGC CGACGG ATT ATC ATA ATG ACT ACC ACA ACG AAT AAC AAA AAG AGT AGC AGA AGGGTT GTC GTA GTG GCT GCC GCA GCG GAT GAC GAA GAG GGT GGC GGAGGG
On line thirteen notice that we have the statement"str[i],str[j],str[k]". We would like to put that into a singlearray like bigstr[64][3]. Thats the idea. Every single tripley thatyou see in the output, we would like to store that into one singlearray to still produce the same output but with a single arraycomposed with those three string arrays. Is that possible? 1.#include <stdio.h> 2.#include <string.h> 3. 4. 5.int main() { 6. 7. char str[4]={'T', 'C', 'A', 'G'}; 8. int i,j,k; 9. 10. for (i=0; i<4; i++) { 11. for (j=0; j<4; j++) { 12. for (k=0; k<4; k++) { 13. printf("%c%c%c",str[i],str[j],str[k]);    14. } 15. } 16. } 17. 18. return 0; 19. } 1.#include <stdio.h> 2.#include <string.h> 3. 4. 5.int main() { 6. 7. char str[4]={'T', 'C', 'A', 'G'}; 8. int i,j,k; 9. 10. for (i=0; i<4; i++) { 11. for (j=0; j<4; j++) { 12. for (k=0; k<4; k++) { 13. printf("%c%c%c",str[i],str[j],str[k]);    14. } 15. } 16. } 17. 18. return 0; 19. }
output:TTT TTC TTA TTG TCT TCC TCA TCG TAT TAC TAA TAG TGT TGCTGA TGG CTT CTC CTA CTG CCT CCC CCA CCG CAT CAC CAA CAG CGT CGC CGACGG ATT ATC ATA ATG ACT ACC ACA ACG AAT AAC AAA AAG AGT AGC AGA AGGGTT GTC GTA GTG GCT GCC GCA GCG GAT GAC GAA GAG GGT GGC GGAGGG
On line thirteen notice that we have the statement"str[i],str[j],str[k]". We would like to put that into a singlearray like bigstr[64][3]. Thats the idea. Every single tripley thatyou see in the output, we would like to store that into one singlearray to still produce the same output but with a single arraycomposed with those three string arrays. Is that possible?

Explanation / Answer

//Hope this will helpyou.
#include <stdio.h> #include <string.h> #include<stdlib.h>
int main() {   char b[64][4];   int count=0;   char str[4]={'T', 'C', 'A', 'G'};   int i,j,k;    for (i=0; i<4; i++) {    for (j=0; j<4; j++) {    for (k=0; k<4; k++){    {       //printf("%c%c%c ",str[i],str[j],str[k]);       sprintf(b[count++],"%c%c%c",str[i],str[j],str[k]);    }        }    }   }      for(i=0;i<count;i++)   printf("%s ",b[i]); system("pause"); return 0; }
#include <stdio.h> #include <string.h> #include<stdlib.h>
int main() {   char b[64][4];   int count=0;   char str[4]={'T', 'C', 'A', 'G'};   int i,j,k;    for (i=0; i<4; i++) {    for (j=0; j<4; j++) {    for (k=0; k<4; k++){    {       //printf("%c%c%c ",str[i],str[j],str[k]);       sprintf(b[count++],"%c%c%c",str[i],str[j],str[k]);    }        }    }   }      for(i=0;i<count;i++)   printf("%s ",b[i]); system("pause"); return 0; }