how to find out the reverse number of a digit if it is
input through the keyboard?

Answers were Sorted based on User's Feedback



how to find out the reverse number of a digit if it is input through the keyboard?..

Answer / vignesh1988i

A SMALL IM IMPLEMENTATION OF POINTERS.

#include<stdio.h>
#include<conio.h>
void main()
{
int n,*k,l;
printf("enter the number :");
scanf("%d",&n);
k=&n;
for(int i=1;*k>0;i++)
{
l=(*k)%10;
*k=(*k)/10;
printf("%d",l);
}
getch();
}

Is This Answer Correct ?    10 Yes 1 No

how to find out the reverse number of a digit if it is input through the keyboard?..

Answer / sneha

main( )
{
int x,result,next;
printf("Enter The number to revers=");
scanf("%d",&x);
//5th
result=x%10;
result=result*10;
//4th
next=(x/10)%10;
result=(result+next)*10;
//3rd
next=(x/100)%10;
result=(result+next)*10;
//2nd
next=(x/1000)%10;
result=(result+next)*10;
//1st
next=(x/10000)%10;
result=result+next;
printf("%d",result);
}

Is This Answer Correct ?    3 Yes 0 No

how to find out the reverse number of a digit if it is input through the keyboard?..

Answer / amrit

int main()
{
int a = 5678;
int temp=0,rev;

while((a%10)!=0)
{
rev =a%10;
a=a/10;
temp= temp*10+ rev;
}
return 0;
}

Is This Answer Correct ?    4 Yes 2 No

how to find out the reverse number of a digit if it is input through the keyboard?..

Answer / haris

Try it. It will seriously work. You would appreciate it.


#include<stdio.h>
#include<conio.h>

int main()

{
int x;
int a,b,c,d,e,f,g,h,i;
int sum;

printf("Please enter a five digit number:\n");
scanf("%d",&x);

a=x%10;
b=(x/10)% 10;
c=(x/100)% 10;
d=(x/1000)%10;
e=(x/10000)%10;
f=a*10000;
g=b*1000;
h=c*100;
i=d*10;


sum=f+g+h+i+e;

printf("\n\nThe sum of all digits is %d.",sum);

getch();
return 0;

}

Is This Answer Correct ?    2 Yes 0 No

how to find out the reverse number of a digit if it is input through the keyboard?..

Answer / prince rafi

void main()
{
int num,m,temp=0;
clrscr();
printf("enter the value of num);
do
{
m=m%10;
temp=(temp*10)+m;
num=num/10;
}
while(num>0);
printf("%d",sum);
}
getch();
}

Is This Answer Correct ?    1 Yes 0 No

how to find out the reverse number of a digit if it is input through the keyboard?..

Answer / sreejesh1987

int rev(int,int);
void main()
{
int a,b;
clrscr();
printf("\nEnter the number to reverse:");//456
scanf("%d",&a);
b=a%10;//b=6
printf("\nReverse of the number is: %d",rev(a,b));
getch();
}

int rev(int a,int b)
{
if(a>9)//456
{
a=a/10;//a=45
b=b*10+a%10;//65
return rev(a,b);
}
else
return b;
}

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

Explain can static variables be declared in a header file?

0 Answers  


How can I increase the allowable number of simultaneously open files?

1 Answers   ABC,


what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;

0 Answers   L&T,


Do you know the difference between malloc() and calloc() function?

0 Answers  


How are portions of a program disabled in demo versions?

0 Answers  






What is #include in c?

0 Answers  


SRUCTURE PROGRAMMING

3 Answers   CTS, Wipro,


how do u find out the number of 1's in the binary representation of a decimal number without converting it into binary(i mean without dividing by 2 and finding out the remainder)? three lines of c code s there it seems...can anyone help

5 Answers  


can you explain in brief what is "r+" mode in a file... i know that it si used to read and modify rhe existing content.... but explalanation about the file pointer in "r+" mode i wann to know???????????

2 Answers   Cognizant,


write a c program that if the given number is prime, and their rearrangement(permute) of that number is also prime. Ex: Input is "197" is prime Output: 791,917,179 is also prime. Please any one tell me tha code for that

3 Answers  


a=0; while(a<5) printf("%d\n",a++); how many times does the loop occurs? a.infinite b.5 c.4 d.6

7 Answers   TCS,


What is sizeof in c?

0 Answers  


Categories