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

what is c?

7 Answers   Tech Mahindra,


What is the result main() { char c=-64; int i=-32 unsigned int u =-16; if(c>i){ printf("pass1,"); if(c<u) printf("pass2"); else printf("Fail2");} else printf("Fail1); if(i<u) printf("pass2"); else printf("Fail2") } a)Pass1,Pass2 b)Pass1,Fail2 c)Fail1,Pass2 d)Fail1,Fail2 e)none

9 Answers   IBM,


What is a example of a variable?

0 Answers  


What are the advantages of c preprocessor?

0 Answers  


what is the height of tree if leaf node is at level 3. please explain

0 Answers  






Can we replace the struct function in tree syntax with a union?

0 Answers   Huawei,


create a C program that displays one z,two y's,three x's until twenty six A's. plzz answer i need it tomorrow.

4 Answers  


program to print circle structure

1 Answers  


Write a C program to convert an integer into a binary string?

1 Answers  


The purpose of this exercise is to benchmark file writing and reading speed. This exercise is divided into two parts. a). Write a file character by character such that the total file size becomes approximately >10K. After writing close the file handler, open a new stream and read the file character by character. Record both times. Execute this exercise at least 4 times b). Create a buffer capable of storing 100 characters. Now after generating the characters, first store them in the buffer. Once the buffer is filled up, store all the elements in the file. Repeat the process until the total file size becomes approximately >10K.While reading read a while line, store it in buffer and once buffer gets filled up, display the whole buffer. Repeat the exercise at least 4 times with different size of buffer (50, 100, 150 …). Records the times. c). Do an analysis of the differences in times and submit it in class.

0 Answers  


#include<stdio.h> #include<conio.h> void main() { clrscr(); int a=0,b=0,c=0; printf("enter value of a,b"); scanf(" %d %d",a,b); c=a+b; printf("sum is %d",c); getch(); }

2 Answers  


What is the total generic pointer type?

0 Answers  


Categories