Inlab 10 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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; }

7th Nov 2017, 6:37 AM
atharva dubey
atharva dubey - avatar
1 Answer
+ 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
7th Nov 2017, 7:02 AM
qwerty
qwerty - avatar