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 |
What is the right type to use for boolean values in c? Is there a standard type?
the number 138 is called well ordered number because the three digits in the number (1,3,8) increase from left to right (1<3<8). the number 365 is not well ordered coz 6 is larger than 5. write a program that wull find and display all possible three digit well ordered numbers. sample: 123,124,125,126,127,128,129,134 ,135,136,137,138,139,145,146,147 148 149,156.......789
what is ur strangth & weekness
0 Answers Cognizant, LG Soft, NetEnrich,
Can anyone tell what is stack overflow? what precaution we should take?
How can I delete a file?
can we declare a variable in different scopes with different data types? answer in detail
What is the difference between procedural and declarative language?
int j =15,i; for (i=1; 1<5; ++i) {printf ("%d%d ",j,i); j = j-3; }
what does ‘Bus Error’ mean?
Identify the operators that is not used with pointer a. && b. # c. * d. >>
wat is the output int main() { char s1[]="Hello"; char s2[]="Hello"; if(s1==s2) printf("Same"); else printf("Diff"); }
What are the 4 types of programming language?