Tag Archives: read

Write a Program in ‘C’ to copy one file to another. The program should read the filenames at command line. 10m Jun2009

Write a Program in ‘C’ to copy one file to another. The program should read the filenames at command line. 10m Jun2009 Code: #include<stdio.h> int main(int argc,char *argv[]) { FILE *fs,*ft; int ch; if(argc!=3) { printf(“Invalide numbers of arguments.”); return 1; } fs=fopen(argv[1],”r”); if(fs==NULL) { printf(“Can’t find the source file.”); return 1; } ft=fopen(argv[2],”w”); if(ft==NULL)… Read More »

Write a program to read formatted data from the file. 6m Jun2008

Write a program to read formatted data from the file. 6m Jun2008 CODE:- #include<stdio.h> void main() { int account; char name[30]; double bal; FILE *fp; if((fp=fopen(“data.txt”,”r”))== NULL) printf(“FILE not present \n”); else do{ fscanf(fp,”%d%s%lf”,&account,name,&bal); if(!feof(fp)) { if(bal==0) printf(“%d %s %lf\n”,account,name,bal); } }while(!feof(fp)); getch(); } [codesyntax lang=”c”] #include<stdio.h> void main() { int account; char name[30]; double… Read More »

An Assembly Language program to find minimal and maximal elements – IGNOU MCA Assignment 2014 – 15

 MASTER OF COMPUTER APPLICATIONS Course Code : MCSL-017 Course Title : C and Assembly Language Programming Assignment Number : MCA(1)/L017/Assign/2014-15 Maximum Marks : 100 Weightage : 25%   Develop and execute an assembly language program to read an array of numbers and find the minimal and maximal elements.    DATA SEGMENT ARR DB 5,3,7,1,9,2,6,8,4 LEN… Read More »

ASSEMBLY18 An Assembly program to read in decimal inputs repeatedly untill a zero value is read, At this point it should print out the sum of the numbers read in so far

Now we will write another Assembly program to read  in decimal inputs repeatedly untill a zero value is read, At this point it should print out the sum of the numbers read in so far. Let’s identify variables needed for this program. First variables will be holding the Messages “ENTER NO.BETN (0-9) & (ENTER ZERO TO STOP) ” and “TOTAL SUM… Read More »

ASSEMBLY09 An Assembly program to read in two decimal inputs and print out the smaller of the two, in decimal

Now we will write another Assembly program to read  two decimal inputs and print out the smaller of the two, in decimal Let’s identify variables needed for this program. First variables will be the one which will hold the values present in the variables to be Added and it will be NUM1 and NUM2 and Other variables will be holding… Read More »

ASSEMBLY08 An Assembly program to read in two decimal inputs and print out their sum, in decimal

Now we will write another Assembly program to read  two decimal inputs and print out their sum, in decimal Let’s identify variables needed for this program. First variables will be the one which will hold the values present in the variables to be Added and it will be NUM1 and NUM2. Other variable will be holding the Output or Result… Read More »

ASSEMBLY06 An Assembly program to read two decimal numbers, then multiply them together and finally print out the result (in decimal )

Now we will write another Assembly program to read  two decimal numbers, then multiply them together and finally print out the result (in decimal ) Let’s identify variables needed for this program. First variables will be the one which will hold the values present in the variables to be Multiplied and it will be NUM1 and… Read More »

ASSEMBLY03 An Assembly program to read ten (10) characters from console

Now we will write another Assembly program which reads ten (10) characters from console. Let’s identify variables needed for this program. First variable will be holding the Message “ENTER 10 CHARACTERS : ” to be printed for the User, So in all One variable. The identified variable is MESSAGE. First Line – DATA SEGMENT DATA SEGMENT is the… Read More »

ASSEMBLY02 An Assembly program to read a character from console and echo it.

Now we will write another Assembly program which read a character from console and echo it. Let’s identify variables needed for this program. First variable will be the one which will hold the values entered at Console and it will be X. Other variable will be holding the Message “ENTER CHARACTER” to be printed for… Read More »