0
Inlab 10
Program: #include<stdio.h> #include<string.h> int main() { char UGC[13]; scanf("%s",&UGC); if(strlen(UGC) ==12) { int sum = 0; for(int i = 0;i<11;i+=2) sum += (UGC[i] - '0'); sum *= 3; for(int i = 1;i<11;i+=2) sum += (UGC[i] - '0'); if ((UGC[11] == '0') && ((sum%10)==0)) printf("Validated"); else if ((UGC[11]-'0') == (10-(sum%10))) printf("Validated"); else printf("Error in barcode"); } else printf("Cannot be processed"); return 0; }
1 Respuesta
+ 10
Why do you post this c code here? Just get a C compiler and run it there.
https://www.sololearn.com/discuss/321242/?ref=app