Free and Open Source Software Question Paper
Free and Open Source Software Question Paper
1. There are N switches which are initially OFF. First you turn ON every
switch. Then, you turn off every second switch. On the third round, you
toggle every third switch (turning ON if it’s OFF and turning OFF if it’s
ON).
For the ith round, you toggle every ith switch.
For the Nth round, you only toggle the last switch.
Write a shell script to find the no. of switches that are ON after N rounds.
Input Format : N
Where N - Number of Switches
Sample
Input : 6
Output : 2
Explanation