Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Let us say a Company uses codes to represent its various products a codes includ

ID: 3624348 • Letter: L

Question

Let us say a Company uses codes to represent its various products
a codes includes, among other information, a character in tenth position
that represents the zone from which that product was made, and 4 digits
integer in position 4 thru 7 that represents the district in which it will
be sold. Due to some reorganization, products from zone R are banned
from being sold in districts with a designation of 2000 or higher.
Write a complete program to count and print number of banned 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

trying to learn java want to know how to use sub string to detect certain pieces of a string

Explanation / Answer

Dear user, Here is the logic code in c program: #include<stdio.h>
int main() {    char code[20];     int number=0,i;     printf("Enter code");    gets(code);     while(code[i]!='')     {       if(code[i]!=13)      {          printf("improper lenght");      }      else       {         for(i=3;i<7;i++)        if(code[i]>=0 &&code[i]<=9)             number=number*10+code[i];       else       {          printf("district is not numeric");       }    }    if(number<=2000)    {       printf("valid");        printf("Enter code");    }   }    return 0; }