Loops - Hackerrank solution

 

Loops


Task


Read an integer N. For all non-negative integers i<N, print i^2. See the sample for details.
Input Format
The first and only line contains the integer, N.


Constraints
1<=N<=20
Output Format
Print N lines, one corresponding to each i.


Sample Input 0
5
Sample Output 0
0
1
4
9
16


Solution:

n = int(input())

for i in range(n):
    print(i ** 2)



Note:

This Code is Verified by all Test Cases.If any error occurs then Comment correct code Below in comment box.

Disclaimer:-

 The above hole problem statement is given by hackerrank.com, but the solution is generated by the CodexRitik . if any of the query regarding this post or website fill the following contact form Thank You. 


Loops - Hackerrank solution Loops - Hackerrank solution Reviewed by CodexRitik on March 15, 2020 Rating: 5

No comments:

Powered by Blogger.