25 February 2012

Write a program for a 5 digit no to print a new number by adding one to each of its digits

void main()
{
float a,b,c,d,e,t,s;
int a1,b1,c1,d1,e1,a2,b2,c2,d2,e2;
printf("\nInput a 5 digit number");
scanf("%f",&t);

a=t/10000.0;
a1=a;
b=(t-(a1*10000.0))/1000;
b1=b;
c=(t-(a1*10000.0)-(b1*1000))/100;
c1=c;
d=(t-(a1*10000.0)-(b1*1000)-(c1*100))/10;
d1=d;
e=(t-(a1*10000.0)-(b1*1000)-(c1*100)-(d1*10))/1;
e1=e;


a2=a1+1;
b2=b1+1;
c2=c1+1;
d2=d1+1;
e2=e1+1;

if (a2==10)
a2=0;
if (b2==10)
b2=0;
if (c2==10)
c2=0;
if (d2==10)
d2=0;
if (e2==10)
e2=0;


s=(a2*10000.0)+(b2*1000.0)+(c2*100.0)+(d2*10.0)+(e2);


printf("\nThe required result is %f",s);
}

2 comments:


  1. This professional hacker is absolutely reliable and I strongly recommend him for any type of hack you require. I know this because I have hired him severally for various hacks and he has never disappointed me nor any of my friends who have hired him too, he can help you with any of the following hacks:

    -Phone hacks (remotely)
    -Credit repair
    -Bitcoin recovery (any cryptocurrency)
    -Make money from home (USA only)
    -Social media hacks
    -Website hacks
    -Erase criminal records (USA & Canada only)
    -Grade change

    Email: onlineghosthacker247@ gmail .com

    ReplyDelete
  2. Do you need to increase your credit score?
    Do you intend to upgrade your school grade?
    Do you want to hack your cheating spouse Email, whatsapp, Facebook, instagram or any social network?
    Do you need any information concerning any database.
    Do you need to retrieve deleted files?
    Do you need to clear your criminal records or DMV?
    Do you want to remove any site or link from any blog?
    you should contact this hacker, he is reliable and good at the hack jobs..
    contact : cybergoldenhacker at gmail dot com

    ReplyDelete