Tuesday 8 September 2009

A 5 DIGIT NUMBER IS INPUT THROUGH THE KEY BOARD. OUTPUT IS A NEW NUMBER ADDING 1 TO EACH OF ITS DIGITS. IN C


A 5 digit number is input through the key board. Output is a new
number adding 1 to each of its digits in c programming



#include

int add(long int);



int main(){

  long int num;

  int add(long int);



 
printf("\nEnter a 5 digit number:
");

 
scanf("%ld",&num);

 
add(num);



  return 0;

}

 add(long int num){

   long int r;

   if(num){

         r=num%10;

       
r=r+1;

No comments:

Post a Comment