Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int getuserchoice()
- {
- int n;
- printf("---ISBN Validate---");
- printf("n1-ISBN Checking");
- printf("n2-Quit");
- printf("nSelect: ");
- scanf("%d", &n);
- return n;
- }
- int main()
- {
- long a[10];
- long sum=0;
- int i=0,n=1;
- long x;
- if(getuserchoice()==1)
- {
- printf("nEnter the values for ISBN number : ");
- scanf("%ld", &x);
- if(x>0)
- {
- while(x>0)
- { a[i]=x%10;
- x=x/10;
- i++;
- }
- }
- for(i=0;i<10;i++)
- printf("%ldt", a[i]);
- for(i=0;i<10;i++)
- {
- sum+=a[i]*n;
- n++;
- }
- if(sum%11==0) printf("nISBN Status: Valid!");
- else printf("nISBN Status: Invalid!");
- }
- else printf("nSee you later!");
- getchar();
- return 0;
- }
Add Comment
Please, Sign In to add comment