Tag Archives: two

A C program to swap the values of two variables, using pointers – IGNOU MCA Assignment 2014 – 15

 MASTER OF COMPUTER APPLICATIONS Course Code : MCS-011 Course Title : Problem Solving and Programming Assignment Number : MCA(1)/011/Assign/2014-15 Maximum Marks : 100 Weightage : 25%   Write an interactive C program to swap the values of two given variables, using pointers.   # include <stdio.h> void main() { int M,N; void swapRef ( int… Read More »

A C program to add two fractions & print resultant fraction – IGNOU MCA Assignment 2014 – 15

MASTER OF COMPUTER APPLICATIONS Course Code : MCS-011 Course Title : Problem Solving and Programming Assignment Number : MCA(1)/011/Assign/2014-15 Maximum Marks : 100 Weightage : 25%   Write a C program to add two fractions and display the resultant fraction. The program should prompt the user to input Fraction-One and Fraction-Two. The numerator and denominator of each fraction‟s are… Read More »

Write a recursive program in ‘C’ to find the L.C.M. (Least Common Multiple) of two given numbers. 10m Dec2006

Write a recursive program in ‘C’ to find the L.C.M. (Least Common Multiple) of two given numbers. 10m Dec2006 #include<stdio.h> int lcm(int,int); void main() { int NUM1,NUM2,LCM; clrscr(); printf(“ENTER ANY TWO POSITIVE NUMBERS TO FIND ITS L.C.M. : “); scanf(“%d%d”,&NUM1,&NUM2); if(NUM1>NUM2) LCM = lcm(NUM1,NUM2); else LCM = lcm(NUM2,NUM1); printf(“LCM OF TWO NUMBERS IS %d”,LCM); getch();… Read More »

Write a program in ‘C’ for the addition of two polynomials. Use Arrays and Structures. 10m Dec2006

Write a program in ‘C’ for the addition of two polynomials. Use Arrays and Structures. 10m Dec2006 #include<stdio.h> void main() { int poly1[6][2],poly2[6][2],term1,term2,match,proceed,i,j; printf(“Enter the number of terms in first polynomial : “); scanf(“%d”,&term1); printf(“Enter the number of terms in second polynomial : “); scanf(“%d”,&term2); printf(“Enter the coeff and expo of the first polynomial:\n”); for(i=0;i<term1;i++)… Read More »

What is the difference between a function and a macro? Find the largest number among two numbers using a function definition as well as a macro. Which is more efficient in terms of execution time and code size? 10m Jun2006

What is the difference between a function and a macro? Find the largest number among two numbers using a function definition as well as a macro. Which is more efficient in terms of execution time and code size? 10m Jun2006  Difference between a function and a macro:    Function Code [codesyntax lang=”c”] int MAX(X,Y) {… Read More »

Write a Menu driven program in C to add, subtract add multiply two distances which are given in feet and inches. 10m Dec2005

Write a Menu driven program in C to add, subtract add multiply two distances which are given in feet and inches. [e.g. 3 ft 9 inches + 2 ft 5 inches=6 ft 2 inches]. 10m Dec2005 #include<stdio.h> struct LENGTH {     int FEET;     int INCH; }; void main() {  int I;  struct LENGTH A,B;… Read More »

Design an algorithm and draw corresponding flowchart to find all the prime numbers between two given numbers ‘m’ and ‘n’, where m, n > 0. 10m Dec2005

Design an algorithm and draw corresponding flowchart to find all the prime numbers between two given numbers ‘m’ and ‘n’, where m, n > 0. 10m Dec2005 An algorithm is a finite set of steps defining the solution of a particular problem. An algorithm is expressed in pseudo code – something resembling C language or… Read More »

Write the functions to perform the following : 10m Dec2005

Write the functions to perform the following : 10m Dec2005   (i) To find mn where m, n > 0 #include<stdio.h> void main() {  long int power(int,int);  int M,N;  long int RES;  printf(“ENTER M : “);  scanf(“%d”,&M);  printf(“ENTER N : “);  scanf(“%d”,&N);  RES=power(M,N);  printf(“\nRESULT IS %ld “,RES);  getch(); } long int power(int M,int N) {  long… Read More »

An Assembly Lanuage Program, which takes two inputs as strings and display the Concatenated string.

Now we will write another Assembly Lanuage Program, which takes two inputs as strings and display the Concatenated string. Let’s identify variables needed for this program. First variables will be the one which will hold the Strings entered by user in the variables P1 LABEL BYTE    M1 DB 0FFH    L1 DB ?    P11 DB 0FFH DUP (‘$’),… Read More »

An Assembly Program, which should add two 5-byte numbers (numbers are stored in array- NUM1 & NUM2), and stores the sum in another array named RESULT

Now we will write another Assembly Program, which should add two 5-byte numbers (numbers are stored in array- NUM1 & NUM2), and stores the sum in another array named RESULT. Let’s identify variables needed for this program. First variables will be the one which will hold the values present in the Given Arrays and it… Read More »