Tag Archives: number

Design an algorithm and draw corresponding flowchart to print the value of the number in words when the number entered is in the range of 1 to 299. 10m Dec2006

Design an algorithm and draw corresponding flowchart to print the value of the number in words when the number entered is in the range of 1 to 299. 10m Dec2006 #include <stdio.h> #include <string.h> #include <stdlib.h> void main() { char num[3]; void convert_to_words(char*); clrscr(); printf(“Enter any number between 1 to 299 : “); scanf(“%s”,&num); convert_to_words(num);… 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 an algorithm and draw a corresponding flowchart to search a number in the given list of numbers and also display its position. 10m Dec2005

 Write an algorithm and draw a corresponding flowchart to search a number in the given list of numbers and also display its position. 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 Pascal, but… Read More »

Write a recursive program in ‘C’ to find whether a given five digit number is a palindrome or not. 10m Dec2005

Write a recursive program in ‘C’ to find whether a given five digit number is a palindrome or not. 10m Dec2005 #include<stdio.h> int flag=0; void palin(int,int*); void main() { int a; clrscr(); printf(“Enter the number “); scanf(“%d”,&a); palin(a,&a); if(flag==0) printf(“\nThe number is palindrome…”); else printf(“\nThe number is not palindrome…”); getch(); } void palin(int x,int* y)… Read More »

Design an algorithm and draw corresponding flowchart to convert a decimal number to its hexadecimal equivalent. 10m Dec2005

Design an algorithm and draw corresponding flowchart to convert a decimal number to its hexadecimal equivalent. 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 Pascal, but with some statements in English rather than… Read More »

Write a program in ‘C’ to add the given number of days to the current date and print the (final) resultant date. (for e.g. adding 12 days to 22/08/2005 will result in 03/09/2005) 10m Dec2005

Write a program in ‘C’ to add the given number of days to the current date and print the (final) resultant date. (for e.g. adding 12 days to 22/08/2005 will result in 03/09/2005)  10m Dec2005     #include <time.h> #include <stdio.h> void  main() { struct tm date = {0} ; time_t timer; clrscr(); timer=time(NULL); date =… Read More »

Write an algorithm and draw a corresponding flow chart to print the sum of the digits of a given number

Write an algorithm and draw a corresponding flow chart to print the sum of the digits of a given number 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 Pascal, but with some statements… Read More »

An Assembly Lanuage Program to search for a character in a given string and calculate the number of occurrences of the character in the given string

Now we will write another Assembly Lanuage Program to search for a character in a given string and calculate the number of occurrences of the character in the given string Let’s identify variables needed for this program. First variable will be the one which will hold the Strings entered by user in the variables P1 LABEL BYTE   … Read More »

An Assembly program which should convert 4 digits BCD number into its binary equivalent

Now we will write another Assembly which should convert 4 digits BCD number into its binary equivalent. Let’s identify variables needed for this program. First variables will be the one which will hold the value present in the variable BCD to be converted and TEMP will hold the converted Hexadecimal equivalent and then to print its Binary… 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 »