Question #244444

If a five-digit number is input through the
keyboard, Draw a flowchart to print code A as
1
st three digits and code B as last two digits.
Example: Input: 12345
Code A: 123 Code B:45

Expert's answer

#include<stdio.h>  


void main()
{
	long int number;
	int temp;
	int i;


	printf("Enter a five-digit number: ");
	scanf("%ld",&number);


	printf("Code A: ");
	for(i=10000;i>10;i/=10){
		temp=number/i;
		number=number%i;
		printf("%d",temp);
	}
	printf("\nCode B: ");
	for(i=10;i>=1;i/=10){
		temp=number/i;
		number=number%i;
		printf("%d",temp);
	}
	


	getchar();
	getchar();


}




Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS