Saturday, October 22, 2011

solution of balagurusamy of chapter 7.14

#include<stdio.h>
main()
{
char ch[14],i,s=0,d=1;
printf("Enter the ISBN number:\n");
scanf("%s",&ch);
for(i=0;i<=12;++i)
{
 if(ch[i]<=9)
 {
  s+=ch[i]*d;
  d+=1;
 }
}
if(s%11==ch[13])
{
printf("Valid ISBN");
}
else
{
printf("Invalid ISBN");
}
return 0;
}

No comments:

Post a Comment