HackerEarth's basic programming solutions( Count Divisors, Factorial!, Toggle String, Roy and Profile Picture ) :
Problem 7: Count Divisors Solution: (in c++) ( please guys before moving to the solution try it yourself at least 3-4 times , if you really wanna become a good coder) #include < bits/stdc++.h > using namespace std ; int main () { int l , r , k , count = 0 ; cin >> l >> r >> k ; for ( int i = l ; i <= r ; i ++) { if ( i % k == 0 ) { count ++; } } cout << count << endl ; } This code is simple. There's no need for any explanation. Problem 8: Factorial! Solution: (in c++) ( please guys before moving to the solution try it yourself at least 3-4 times , if you really wanna become a good coder) #include< bits/stdc++.h > using namespace std ; int main () { long long int n , i , f = 1 ; cin >> n ; for ( i = 1 ; i <= n ; i ++) { f = f * i ; } cout << f << endl ; } This