reverse number program without using loop in c language
Answers
Answered by
1
Answer:
1.First initialize two integer variable like (num, temp).
2.Now perform reverse operation with both variable.
3.Finally show the result on output screen after reverse.
Answered by
1
Answer:
You have to use a loop or you can use stack implementation, (stack Data structure)
Here, i provided you the basic program using loop,
for stack, you have to define stack in C, or can use stack header in cpp if you know about stack.
C Program =>
int main(void){
int n;
cin >> n;
int ans = 0;
while(n > 0){
int last = n%10;
ans = 10*ans + last;
n /= 10;
}
cout << ans;
}
Like and Mark as Brainliest, it really motivates!
Similar questions