Let us say a Company uses codes to represent its variousproducts a codes include
ID: 3612950 • Letter: L
Question
Let us say a Company uses codes to represent its variousproducts
a codes includes, among other information, acharacter in tenth position
that represents the zone from which that product wasmade, and 4 digits
integer in position 4 thru 7 that represents the districtin which it will
be sold. Due to some reorganization, products from zone Rare banned
from being sold in districts with a designation of 2000 orhigher.
Writ a complete program to count and print number ofbanned and valid 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.