Check this Out!!!

A

aslamhenry

please key in any 5 digits number : 56789

and the ouput is
5678 9
567 89
56 789
5 6789


how to write those program......


my idea is like this...


#include <stdio.h>

void main()

{ float number=0;
int number1=0, number2=0, number3=0, number4=0;
int remainder1=0, remainder2=0, remainder3=0, remainder4=0;

printf("Please input a five-digit number : ");
scanf("%f",&number);

number1 = number/10;
remainder1 = number - (number1*10);
printf("\n%d %d ",number1,remainder1);

number2 = number/100;
remainder2 = number - (number2*100);
printf ("\n %d %d ",number2,remainder2);

number3 = number/1000;
remainder3 = number - (number3*1000);
printf ("\n %d %d ",number3,remainder3);

number4 = number/10000;
remainder4 = number - (number4*10000);
printf ("\n %d %d ",number4,remainder4);



}
________________________________________________________________________________
#include <stdio.h>

void main()
{
long int num;
float num1,num2,num3,num4;
float r1,r2,r3,r4;

printf("please key in any 5 digit number:");
scanf("%ld",&num);


num1=num/10;
num2=num/100;
num3=num/1000;
num4=num/10000 ;

r1=num%10;
r2=num%100 ;
r3=num%1000 ;
r4=num%10000 ;

printf("\n %.0f %.0f",num1,r1);
printf(" \n %.0f %.0f",num2,r2);
printf(" \n %.0f %.0f",num3,r3);
printf(" \n %.0f %.0f",num4,r4);
}
________________________________________________________________________________

right now still thinking how to use looping on it.By using only
<stdio.h>
 
J

Jack Klein

please key in any 5 digits number : 56789

and the ouput is
5678 9
567 89
56 789
5 6789


how to write those program......


my idea is like this...


#include <stdio.h>

void main()

You have been told MANY times in the past few days when posting your
homework assignment to C and C++ newsgroups that void main() IS WRONG.

If you won't even bother to fix that, why should anyone waste any more
of their time trying to help you?

*plonk*

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html
 
A

Army1987

please key in any 5 digits number : 56789

and the ouput is
5678 9
567 89
56 789
5 6789


how to write those program......
You have had many helpful suggestions these days, and you have
ignored them, so I will ignore you, too. For now, 7 days are
enough, but they'll double next time.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top