How to write an algorithm to swap values ?

/* part of work copied from http://www.sanfoundry.com/c-program-swap-values/ */ #include <stdio.h> swap_values() { int temp; int *ptr1, *ptr2; int a, b; printf(“Enter integer values to be swapped: “); scanf(“%d %d”,&a,&b); ptr1 = &a; ptr2 = &b; temp = *ptr1; *ptr1 = *ptr2; *ptr2 = temp; printf(“Swapped values are: %d %d \n”,a,b); } /* http://www.programmingsimplified.com/c-program-swap-two-numbers */ /* …

Hacking with integer divisibility

/* work copied from http://www.sanfoundry.com/c-program-number-divisible-by-5/ */ #include <stdio.h> numberdivi() { int i, num1, num2, count = 0, sum = 0; printf(“Enter the value of num1 and num2 : “); scanf(“%d %d”,&num1,&num2); for (i = num1; i < num2 ; i++) { if ((i % 5) == 0) { printf(“%3d,”,i); count++; sum = sum + i; …