Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2014
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main ( void )
  5. {
  6. int total = 0, i;
  7. int array [ 4 ] = {4,3,7,5,2};
  8. int input [ 5 ] = {0};
  9. scanf ( "%d%d%d%d%d", input );
  10. for ( i = 0; i < 5; i++ ) {
  11. total += array [ i ] * input [ i ]; }
  12. total % 10;
  13. if ( total == array [ 5 ] )
  14. printf ( "%d%d%d%d%d is correct", input [ 5 ] );
  15. else
  16. printf ( "%d%d%d%d%d has an error", input [ 5 ] );
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement