Sunday, April 5, 2020

C Program Example To Reverse Number And String | C Programming Example

C Program Example To Reverse Number And String : -  


This Article From Learn c programming in Hindi Will help you to learn Program Example To Reverse Number And String and check out "selection sort program in c", "socket programming in c", "merge sort program in c","Kruskal's algorithm in c", "for loop c programming", "c struct example","simple program in c language", "simple CPP program", "c programming practice questions", "c program using for loop", "programming using c", "hello world program in c", "if statement in c ".


C programming exaple
C programming exaple

  • Source Code To Reverse Number With C Program Example


#include  
 
int main()
 
{
 
   int n, rev = 0;
 
   printf("Please enter a number to reverse\n");
 
   scanf(""%d"",&n);
 
 
 
   while (n != 0)
 
   {
 
      rev = rev * 10;
 
      rev = rev + n%10;
 
      n = n/10;
 
   }
 
 
 
   printf("The reverse of entered number is %d\n", rev);
 
   return 0;
 
}
  • Source Code To Reverse Number With C Program Example


#include
 
#include
 
int main()
 
{
 
   char name[30] = "Hello";
 
   printf("String before strrev( ) : %s\n",name);
 
   printf("String after strrev( )  : %s",strrev(name));
 
   return 0;
 
}

Output


Output:

String before strrev( ) : Hello

String after strrev( ) : olleH

0 Comments:

Post a Comment