Write a program to print the digits of a given numbers in reverse order.
#include<stdio.h>
#include<conio.h>
#include<string.h>
main()
{
clrscr();
char b[30],c[30]={'\0'};//c[30]={'\0'} It empty the array for remove the garbage value.
int i,j,n;
gets(b);
i=strlen(b);
n=i-1;
int m=n;//the lenght of string will not be changed in run time. You change the value of n in loop.
for(j=0 ; j<=m ; j++)
{
c[j]=b[n];
n--;
}
puts(c);
getch();
}
#include<conio.h>
#include<string.h>
main()
{
clrscr();
char b[30],c[30]={'\0'};//c[30]={'\0'} It empty the array for remove the garbage value.
int i,j,n;
gets(b);
i=strlen(b);
n=i-1;
int m=n;//the lenght of string will not be changed in run time. You change the value of n in loop.
for(j=0 ; j<=m ; j++)
{
c[j]=b[n];
n--;
}
puts(c);
getch();
}