Question:C program to reverse a number using for loop 

Answer 
#include<stdio.h>
int main(){
    int num,r,reverse=0;

    printf("Enter any number: ");
    scanf("%d",&num);

    for(;num!=0;num=num/10){
         r=num%10;
         reverse=reverse*10+r;
    }

    printf("Reversed of number: %d",reverse);
    return 0;
}
Sample output: Enter any number: 123 Reversed of number: 321 

+ ExplanationNot Moderated
+ Report
Total Preview: 492
C program to reverse a number using for loop
Copyright © 2024. Powered by Intellect Software Ltd