Answer to Question #244444 in C for Arijit kundu

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
1
Expert's answer
2021-09-29T18:46:24-0400
#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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS