Let us say a Company uses codes to represent its variousproducts a codes include
ID: 3613047 • Letter: L
Question
Let us say a Company uses codes to represent its variousproducts
a codes includes, among other information, a character in tenthposition
that represents the zone from which that product was made, and 4digits
integer in position 4 thru 7 that represents the district inwhich it will
be sold. Due to some reorganization, products from zone R arebanned
from being sold in districts with a designation of 2000 orhigher.
Writ a complete program to count and print number of banned andvalid code entered.
Example: TRV2475A5R-14 valid
TRL2k74A5R-11 : district is not numeric
TRV2105A2 : improper code length
The user should signal end of file to stop the program
Explanation / Answer
please rate - thanks #include #include #include int main() {char code[13+1]; int i,number; bool good; printf("enter code: "); while(scanf("%s",code)!=EOF) {good=true; if (strlen(code)!=13) {printf("%16s: improper length ",code); good=false; } else {number=0; for(i=3;i=0&&code[i]-48=2000&&code[9]=='R') {good=false; printf("%16s: zone R cannot getproducts with code >=2000 ",code); } if(good) printf("%16s: valid ",code); printf("enter code: "); } getch(); return 0; }Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.