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
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 |
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 |
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 |
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 |
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 |
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 |
How pointer is benefit for design a data structure algorithm?
what is link list?
When can you use a pointer with a function?
An integer that indentifies the position of a data item in a sequence of data items a) value b) number c) index d) all of the above
What are the 32 keywords in c?
Explain how can I right-justify a string?
Write a program to print distinct words in an input along with their count in input in decreasing order of their count..
what are the program that using a two dimensional array that list the odd numbers and even numbers separately in a given 10 inputs values
0 Answers College School Exams Tests,
write a program to arrange the contents of a 1D array in ascending order
How do I determine whether a character is numeric, alphabetic, and so on?
Switch (i) i=1; case 1 i++; case 2 ++i; break; case 3 --i; Output of i after executing the program
Here is a neat trick for checking whether two strings are equal