convert 12345 to 54321 withoutusing strig
Answers were Sorted based on User's Feedback
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 |
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 |
#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 |
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 |
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 |
What are the restrictions of a modulus operator?
write the program to find multiplication of 2-D matrix??????????
Eight queens puzzle
Find Error if any in below code, Justify ur answer: struct xx { int a; struct yy { char c; struct xx* p; } struct yy* q; }
convert 0.9375 to binary
What is pointers in c?
The % symbol has a special use in a printf statement. Explain how would you place this character as part of the output on the screen?
HOW TO FIND OUT THE RREVERS OF A GIVEN DIGIT NUMBER IF IT IS INPUT THROUGH THE KEYBORD BY USING C LANGUAGE
6)swap(int x,y) { int temp; temp=x; x=y; y=temp; } main() { int x=2;y=3; swap(x,y); } after calling swap ,what are yhe values x&y?
Software Interview Questions
how to use showbits function?
What is Bitwise Operator and how it works?