Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


convert 12345 to 54321 withoutusing strig

Answers were Sorted based on User's Feedback



convert 12345 to 54321 withoutusing strig..

Answer / abhradeep chatterjee

#include<stdio.h>
#include<conio.h>
void main()
{
int i,j;
printf("enter a number");
scanf("%d",&i);
for(int n=1;n<=5;n++)
{
j=i%10;
i=i/10;
printf("%d",j);
}
getch();
}

Is This Answer Correct ?    5 Yes 4 No

convert 12345 to 54321 withoutusing strig..

Answer / pavan kumar b n

By making use of stack data structure.... i.e., first push
all the numbers and then pop them .. since stack is LIFO
order , the numbers get reversed....

Is This Answer Correct ?    1 Yes 0 No

convert 12345 to 54321 withoutusing strig..

Answer / satrughna sethi

#include<stdio.h>
#include<conio.h>
void main()
{
int i,j;
printf("enter a number");
scanf("%d",&i);
for(int n=1;n<=5;n++)
{
j=i%10;
i=i/10;
printf("%d",j);
}
getch();
}

Is This Answer Correct ?    5 Yes 5 No

convert 12345 to 54321 withoutusing strig..

Answer / ismail

void main()
{
long num, temp;
for(;;) {
printf("Enter number:");
scanf("%ld",&num);
if(num == 0) break;
while(num) {
temp = num%10;
num = num/10;
printf("%ld", temp);
}
printf("\n");
break;
}
getch();
}

Is This Answer Correct ?    0 Yes 0 No

convert 12345 to 54321 withoutusing strig..

Answer / mani bhowmik

void main()
{
int num, temp;
for(;;) {
printf("Enter number:");
scanf("%d",&num);
if(num == 0) break;
while(num) {
temp = num%10;
num = num/10;
printf("%d", temp);
}
printf("\n");
}
getche();
}
So any number will be reversed here. 12345 is five digit
number. Using while we can generalize the number of digits.
The continuous loop is ended when 0 is entered.

Is This Answer Correct ?    1 Yes 5 No

Post New Answer

More C Interview Questions

What are disadvantages of C language.

0 Answers   iNautix,


Why & is used in c?

0 Answers  


Is c language still used?

0 Answers  


Can you subtract pointers from each other? Why would you?

0 Answers  


can anyone please tell about the nested interrupts?

0 Answers  


what does ‘segmentation violation’ mean?

1 Answers  


What do header files do?

0 Answers  


What is use of #include in c?

0 Answers  


i want to know aptitude questions,technical questions

2 Answers  


Explain the difference between call by value and call by reference in c language?

0 Answers  


What are enums in c?

0 Answers  


Can a file other than a .h file be included with #include?

0 Answers   Aspire, Infogain,


Categories