0% found this document useful (0 votes)
44 views4 pages

C Program For Binary Indicator Sequence X

The document contains 6 C programs that take text from a data file as input and produce different types of numerical sequences as output. Program 1-4 create binary indicator sequences where 1 indicates the presence of a letter (a, c, g, t) and 0 indicates its absence. Program 5 creates a real-valued sequence assigning numbers 2-4 to letters and 1 otherwise. Program 6 creates a paired numeric sequence writing +1 or -1 to the output file based on each letter in the input file.

Uploaded by

dineshgarg82
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views4 pages

C Program For Binary Indicator Sequence X

The document contains 6 C programs that take text from a data file as input and produce different types of numerical sequences as output. Program 1-4 create binary indicator sequences where 1 indicates the presence of a letter (a, c, g, t) and 0 indicates its absence. Program 5 creates a real-valued sequence assigning numbers 2-4 to letters and 1 otherwise. Program 6 creates a paired numeric sequence writing +1 or -1 to the output file based on each letter in the input file.

Uploaded by

dineshgarg82
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 4

1. C Program for Binary Indicator sequence xA #include<stdio.h> #include<conio.h> void main() {FILE *fp,*gp; char ch; fp=fopen(data.txt,r); gp=fopen(a_data.

txt,w); while(1) { ch=fgetc(fp); if(ch==EOF) break; else if(ch==\n); if(ch==a) fprintf(gp,1); else fprintf(gp,0); } fclose(fp); fclose(gp); getch(); } 2. C Program for Binary Indicator sequence xC #include<stdio.h> #include<conio.h> void main() {FILE *fp,*gp; char ch; fp=fopen(data.txt,r); gp=fopen(c_data.txt,w); while(1) { ch=fgetc(fp); if(ch==EOF) break; else if(ch==\n); if(ch==c) fprintf(gp,1); else fprintf(gp,0); } fclose(fp); fclose(gp); getch();

} 3. C Program for Binary Indicator sequence xG #include<stdio.h> #include<conio.h> void main() {FILE *fp,*gp; char ch; fp=fopen(data.txt,r); gp=fopen(g_data.txt,w); while(1) { ch=fgetc(fp); if(ch==EOF) break; else if(ch==\n); if(ch==g) fprintf(gp,1); else fprintf(gp,0); } fclose(fp); fclose(gp); getch(); } 4. C Program for Binary Indicator sequence xT #include<stdio.h> #include<conio.h> void main() {FILE *fp,*gp; char ch; fp=fopen(data.txt,r); gp=fopen(t_data.txt,w); while(1) { ch=fgetc(fp); if(ch==EOF) break; else if(ch==\n); if(ch==t) fprintf(gp,1); else fprintf(gp,0); } fclose(fp);

fclose(gp); getch(); } 5. C Program for Real Number Sequence xR #include<stdio.h> #include<conio.h> void main() {FILE *fp,*gp; char ch; fp=fopen(data.txt,r); gp=fopen(real_data.txt,w); while(1) { ch=fgetc(fp); if(ch==EOF) break; else if(ch==\n); if(ch==a) fprintf(gp,2); else if (ch==g) fprintf(gp,3); else if (ch==t) fprintf(gp,0); else fprintf(gp,1); } fclose(fp); fclose(gp); getch(); } 6. C Program for Paired Numeric Sequence xP #include<stdio.h> #include<conio.h> void main() {FILE *fp,*gp; char ch; fp=fopen(data.txt,r); gp=fopen(paired_data.bin,wb); while(1) { ch=fgetc(fp); if(ch==EOF) break; else if(ch==\n);

if(ch==a) fprintf(gp,+1); else if (ch==g) fprintf(gp,-1); else if (ch==t) fprintf(gp,+1); else fprintf(gp,-1); } fclose(fp); fclose(gp); getch(); }

You might also like