Hacking with debian netselect-apt command

$sudo netselect-apt -t 2 -c IN Using distribution stable. Retrieving the list of mirrors from www.debian.org… –2014-08-31 23:00:07– http://www.debian.org/mirror/mirrors_full Resolving www.debian.org (www.debian.org)… 140.211.15.34, 128.31.0.51 Connecting to www.debian.org (www.debian.org)|140.211.15.34|:80… connected. HTTP request sent, awaiting response… 200 OK Length: 350858 (343K) [text/html] Saving to: ‘/tmp/netselect-apt.Pjgwxz’ 100%[====================================================================================>] 3,50,858 110KB/s in 3.1s 2014-08-31 23:00:11 (110 KB/s) – ‘/tmp/netselect-apt.Pjgwxz’ saved …

Hacking with an algorithm to find prime factor of a number

$./app Sign detection [1] Power of two [2] Counting No. of bits set [3] Set or clear bits without branching[4] Find maximum value[5] Finding least common multiple[6] Finding the greatest commom divisor[7] Finding if a number is an Armstrong number or not[8] Finding if a given number is prime number[9] Finding the number of twin …

How to write an algorithm to find if a number is palindrome or not

#include <stdio.h> palindrome() { int n, reverse = 0, temp; printf(“Enter a number to check if it is a palindrome or not: “); scanf(“%d”,&n); temp = n; while ( temp != 0 ) { reverse = reverse * 10; reverse = reverse + temp % 10; temp = temp/10; } if ( n == reverse …

Tinkering with an Armstrong number finding program function

$./app Sign detection [1] Power of two [2] Counting No. of bits set [3] Set or clear bits without branching[4] Find maximum value[5] Finding least common multiple[6] Finding the greatest commom divisor[7] Finding if a number is an Armstrong number or not[8] 8 Enter a positive integer: 153 153 is an Armstrong number $./app Sign …

Hacking with the program to find the greatest common factor

$./app Sign detection [1] Power of two [2] Counting No. of bits set [3] Set or clear bits without branching[4] Find maximum value[5] Finding least common multiple[6] Finding the greatest commom divisor[7] 7 Enter the two values for finding GCD: 12 6 GCD is: 6 $./app Sign detection [1] Power of two [2] Counting No. …