write a program to display reverse of a number using for
loop?

Answers were Sorted based on User's Feedback



write a program to display reverse of a number using for loop?..

Answer / hema

int main()
{
int a = 234;
printf("\n");
while( a != 0)
{
printf("%d",a%10);
a /= 10;
}
return 0;
}
______________________________________________________

use below program if you want to store value in another
variable
______________________________________________________
int main()
{
int a = 234;
int b = 0;
printf("\n");
while( a != 0 )
{
b = b *10 + (a%/10);
a /= 10;
}
printf("\n values in revers order= %d \n",b);
return 0;
}

Is This Answer Correct ?    22 Yes 11 No

write a program to display reverse of a number using for loop?..

Answer / vishnu

int main()
{
int num;
int i;
int a[10];
printf("enter the number \n");
scanf("%d",&num);

for(i =0;num;i++)
{
a[i]=num %10;
num= num/10;
printf("%d",a[i]);
}

getch();
}

Is This Answer Correct ?    29 Yes 21 No

write a program to display reverse of a number using for loop?..

Answer / rakesh ranjan

#include<conio.h>
#include<stdio.h>
main()
{
int x,n,i;
printf("entre the number");
scanf("%d",&n);
for(;n>0;)
{
x=n%10;
printf("%d",x);
n/=10;
}
getch();
}

Is This Answer Correct ?    15 Yes 9 No

write a program to display reverse of a number using for loop?..

Answer / ganagdhara c

#include<stdio.h>
#include<conio.h>
void main()
{
long int num,i;
int d;
clrscr();
printf("\n enter number");
scanf("%ld",&num);
printf("\n the reverse of number %ld is ",num);
for(i=0;num>0;i++)
{
d=num%10;
num=num/10;
printf("%d",d);
}
getch();
}

Is This Answer Correct ?    22 Yes 17 No

write a program to display reverse of a number using for loop?..

Answer / balaji ganesh

#include<stdio.h>
#include<string.h>
void main()
{
char a[50];
int i,n;
clrscr();
printf("\n enter number:");
scanf("%s",a);
printf("reverse number is:");
for(i=strlen(a);i>=0;i--)
{
printf("%c",a[i]);
}
getch();
}

Is This Answer Correct ?    30 Yes 26 No

write a program to display reverse of a number using for loop?..

Answer / narendra

It is simple.use this and it works

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

int main()
{
int rem,num;
clrscr();
printf("Enter the number\n");
scanf("%d",&num);
for (num= num; num > 0; num = num/10)
{

rem = num % 10;
printf("%d",rem);

}
return 0;
}

Is This Answer Correct ?    14 Yes 11 No

write a program to display reverse of a number using for loop?..

Answer / jayesh jain

#include<stdio.h>
#include<conio.h>
void main()
{
int num,i;
int rem;
clrscr();
printf("\n enter number");
scanf("%ld",&num);
printf("\n the reverse of number %ld is ",num);
for(i=0;num>0;i++)
{
rem=num%10;
num=num/10;
printf("%d",rem);
}
getch();
}

Is This Answer Correct ?    5 Yes 2 No

write a program to display reverse of a number using for loop?..

Answer / radhika

#include <stdio.h>
int main(void) {
int num[4], i;
printf("Enter the number :
");
printf("The reverse number is :
");
for(i = 4;i >= 0; i--) {
printf("%d",i);
printf("
");
}
return 0;
}

Is This Answer Correct ?    2 Yes 1 No

write a program to display reverse of a number using for loop?..

Answer / rajesh.k

int main()
{
int num, i;
printf("Enter the number :\n");
scanf("%d",&num);
printf("The reverse number is :\n");
for(i = num;i >= 0; i--) {
printf("%d",i);
printf("\n");
}
getch();
}

Is This Answer Correct ?    20 Yes 21 No

write a program to display reverse of a number using for loop?..

Answer / adarsh sandy

please app log btao ki iska program kaise banega
1
121
12321
121
1

Is This Answer Correct ?    1 Yes 2 No

Post New Answer

More C Interview Questions

write a program in c language that uses function to locate and return the smallest and largest integers in an array,number and their position in the array. it should also find and return the range of the numbers , that is , the difference between the largest number and the smallest.

1 Answers  


diff between exptected result and requirement?

0 Answers   HCL,


find out largest elemant of diagonalmatrix

0 Answers  


How can I make sure that my program is the only one accessing a file?

0 Answers  


What is the purpose of scanf() and printf() functions?

0 Answers  


Which sorting algorithm is the best?

1 Answers  


Write a program to give following output..... ********* **** **** *** *** ** ** * * ** ** *** *** **** **** *********

4 Answers  


WRITE A PROGRAM IN C TO MULTIPLY TWO 2-D ARRAYS

4 Answers  


What is chain pointer in c?

0 Answers  


Add Two Numbers Without Using the Addition Operator

0 Answers  


main() { int i = 10; printf(" %d %d %d ", ++i, i++, ++i); }

0 Answers   Wilco,


what is the use of bitfields & where do we use them?

2 Answers  


Categories