Function Program13

// Function with no return value, with argument


#include<stdio.h>

#include<conio.h>


void rev(long);


void main()

{

long int no;


clrscr();


printf("Enter number: ");

scanf("%ld", &no);


rev(no);


getch();

}


void rev(long x)

{

long int rem, revno=0;


while(x > 0)

{

rem = x % 10;

revno = revno * 10 + rem;

x = x / 10;

}


printf("\n\nRevno is %ld", revno);


}

No comments:

Post a Comment