Instagram
youtube
Facebook

Loops Hackerrank Solution

Mradul Mishra
Table of Contents

Task The provided code stub reads an integer, n, from STDIN. For all non-negative integers i

The provided code stub reads an integer, n, from STDIN. For all non-negative integers i<n , print i*i.

Example

The list of non-negative integers that are less than n=3  is [0, 1, 2]. Print the square of each number on a separate line.

0
1
4

Solution 

if __name__ == '__main__':
    n = int(input())
    for i in range(n):
        print(i*i)

 

Add a comment:

Comments:

Recep Kaya

How did you solve the loop problem?

Nishanthi

I need full answer

Ambika

I want the answer

Varsha

Thank u

sahaya roshan

Thank you

Keerthi Priya

I Want to know answer

rafeeq

Nothing

Karuvelammal

Ans

Babita soni

I want answer

SANTHAVEL V

I want ans

Ankit Gupta

NA

Raja P

python

Rajendra Prasad

Hi

Soumya Smruti Das

Hii

Sneha

Good

K Praveena

Good

Jayabharathi S

No

Palwai Lokesh

Answers

Palwai Lokesh

Answers

rohan

solution

Tanushri Thamake

What comment

Karthik

Good

Komal

No

Siddiki Akbor

hi

nham

i want know the solution

Karthik

I want solution

Karthik

I want solution

Narisetti prathyusha

Good

neha patel

NICE SOLUTION

Keerthanaa

I want to be a hacker

PAVITHRA BEJAWADA

Ntg