fork download
  1. #include<stdio.h>
  2. //----------------------------------------------------------------------
  3. void ISBN_13()
  4. {
  5. int Prefix , Grp_id , Pub_co , Tit_id , Chk_digit;
  6.  
  7. printf(" Enter ISBN-13 like [x-x-x-x-x]: ");
  8. scanf("%d-%d-%d-%d-%d" , &Prefix , &Grp_id , &Pub_co , &Tit_id , &Chk_digit);
  9.  
  10. printf(" Here is what you give: \n");
  11. printf(" GS1 prefix : %d \n Group identifier: %d \n Publisher code: %d \n" ,Prefix , Grp_id , Pub_co);
  12. printf(" Item number: %d \n Chech digit: %d " ,Tit_id , Chk_digit);
  13.  
  14. }
  15. //---------------------------------------------------------------------
  16. void ISBN_10()
  17. {
  18. int Grp_id , Pub_co , Tit_id , Chk_digit;
  19.  
  20. printf(" Enter ISBN-10 like [y-y-y-y]: ");
  21. scanf("%d-%d-%d-%d" , &Grp_id , &Pub_co , &Tit_id , &Chk_digit);
  22.  
  23. printf(" Here is what you give: \n");
  24. printf(" Group identifier : %d \n Publisher identifier: %d \n" ,Grp_id , Pub_co);
  25. printf(" Title identifier: %d \n Check digit: %d " ,Tit_id , Chk_digit);
  26. }
  27. //----------------------------------------------------------------------
  28. void UPC()
  29. {
  30. int Prefix , Man_co , Itm_num , Chk_digit;
  31.  
  32. printf( " Enter UPC code of your product like [z z z z] with spaces: ");
  33. scanf("%d %d %d %d" , &Prefix , &Man_co , &Itm_num , &Chk_digit);
  34.  
  35. printf(" Here is what you give: \n");
  36. printf(" Prefix: %d \n Manufacturer code: %d\n Item number: %d \n" , Prefix , Man_co , Itm_num);
  37. printf(" Check digit: %d " , Chk_digit);
  38.  
  39. }
  40. //----------------------------------------------------------------------
  41.  
  42. int main(void)
  43. {
  44. int ch;
  45.  
  46. printf(" ISBN-13 / ISBN-10 / UPC ? Push 1 / 2 / 3 respectively : ");
  47. scanf("%d" , &ch);
  48.  
  49. if( ch == 1 )
  50. ISBN_13();
  51.  
  52. if( ch == 2)
  53. ISBN_10();
  54.  
  55. if( ch == 3)
  56. UPC();
  57.  
  58. return 0;
  59. }
  60. //----------------------------------------------------------------------
Success #stdin #stdout 0.02s 1724KB
stdin
Standard input is empty
stdout
 ISBN-13 / ISBN-10 / UPC ? Push 1 / 2 / 3 respectively :