Posts

Showing posts from January, 2018

C Program To Reverse a Number

C Program To Reverse a Number Learn How To Reverse A Number in C Programming Language. It is important that we should know   How A For Loop Works  before getting further with this C Program Code. To Reverse the Digits of an Integer, we need to Extract every End Digit using Modulus Operator and then store it in a Sum variable. Then, keep on adding the other digits to the Sum variable. Example Reverse of 1234 = 4321 Method 1: Reverse an Integer with While Loop in C Programming 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 #include<stdio.h> #include<conio.h>   Void main ( ) {      int num , sum = 0 , rem , temp ;      printf ( "\nEnter a Number:\t" ) ;      scanf ( "%d" , & num ) ;      temp = num ;      while ( num > 0 )     ...