Thursday, 3 January 2008

Find g.c.d of two number using c program



Definition
of HCF (Highest
common factor):



HFC is also called greatest
common divisor (gcd).
HCF of two numbers is a largest positive numbers which can divide both numbers
without any remainder.  For example HCF
of two numbers 4 and 8 is 2 since 2 is the largest positive number which can
dived 4 as well as 8 without a remainder. 



Logic
of HCF or GCD of any two numbers:



In HCF we try

Find sum of the digit of number using c program




C program to calculate or find sum
of each digits of a given number





#include


int main(){

int num,sum=0,r;

printf("\nEnter
a number:");

scanf("%d",&num);

while(num){

r=num%10;

num=num/10;

sum=sum+r;

}

printf("sum=%d",sum);

return 0;

}



If
you have any queries in above code find
sum of the digit of number using c program, please share us.

Reverse any number using c program







Code 1:

1. Write a c program to reverse a given number

2. C program to find reverse of a number


3. C program to reverse the digits of a number
4. Reverse of a number in c using while loop



#include

int main(){

    int num,r,reverse=0;



    printf("Enter any number: ");

    scanf("%d",&num);



    while(num){

         r=num%10;

         reverse=reverse*10+r;

        

Tuesday, 1 January 2008

sql,pl/sql questions with solutions and explanations

C QUESTIONS WITH SOLUTIONS
C QUESTIONS WITH SOLUTIONS

JAVA QUESTIONS WITH SOLUTIONS
JAVA QUESTIONS WITH SOLUTIONS

SQL QUESTIONS WITH SOLUTIONS
SQL QUESTIONS WITH SOLUTIONS

PL/SQL QUESTIONS WITH SOLUTIONS
PL/SQL QUESTIONS WITH SOLUTIONS

Write an assembly language program in c program to find out factorial of given number?

Answer:
void main(){ int num; clrscr(); scanf("%d",&num); asm mov ax,1; asm mov bx,1; asm mov cx,num; come: asm mul bx; asm inc bx; asm dec cx; asm jnz come; printf("%d ",_AX); getch(); }More question

asm keyword in c programming language



asm keyword in c programming language



Keyword asm is used to write
assembly language code in c programming.



(1) What will be output of
following c program?



#include

int main(){



asm{

         mov ax,10;

         shl,2;

    }



printf("%d",_AX);

return 0;

}



Output: 40

Explanation: ax and bx is general
purpose register. Statement mov ax, 61 means value 61 is storing

Assembly language program in c programming language

Assembly language program in c programming language. (1) What will be output of following c program? void main() { clrscr(); asm{       mov ax,61;       mov bx,10;       add bx,ax;     }   printf("\n%d",_BX); getch(); } Output: 71 Explanation: ax and bx is general purpose register. Statement  mov ax,61 means value 61 is storing at register ax. Statement add bx,ax meand addition