python for loop

HackerRank – Loops In Hindi

Hacker Rank

HackerRank – Loops In Hindi- Is Post Me HackerRank Ke Python Programming Language Se Related Competitive Questions Ka Answer Hai. Is Post Me HackerRank – Loops No 5 Ko Solve Kiya Gaya Hai.

HackerRank – Python Solution Series Ke Sabhi Questions Ka Solution Codes Ko Diya Jayega. Saath Hi Hindi Me Explain Bhi Kiya Jayega.

Yadi Aapne Abhi Tak Python Full Course In Hindi Read Nhi Kiya Hai To Aap Pahle Wo Kare Nhi To Aapko HakcerRank- Python Solution Ke Tutorial Ko Understand Karne Main Dikkat Ho Sakti Hai.

HackerRank – Loops In HIndi

Task

  • User se ek +ve integer n input lena hai.
  • if n>i,  print n2.

Example

n = 3

Yaha par n ka value 3 hai. 3 ek +ve integer hai. Ab 3 > [0,1,2]

Ab 0 ,1 ,2 ka square print karna hai.

0*0 = 0
1*1 = 1
2*2 = 4

Input

First line par variableke liye +ve integer input lena hai.

Constraints

1 <= n <=20

Output

n ka sqare ko print kare. n no of lines tak.

Sample Input 0

5

Sample Output 0

0
1
4
9
16

Explanation 0

Variable n ke +ve integer input lena hai
n ke square ko print kare, n no of lines tak. 

Solution

if __name__ == '__main__':
    n = int(input())

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

Output

5 

0
1
4
9
16

STEP 1 – Sabse Pahle variable ke value ke liye input lena hai, int(input()) phir use integer me convert karna hai.

STEP 2 – i ke sqare ko print kare, n no of line rahega.

Agar n ka value 3 hai to i ke then i ka value 0 se 2 tak hai.

STEP 3 – sabse pahle i = 0 hai, then i*i print kare.

Upar Diye Hue Code Ko Aap Apne Code Editor Me Use Kar Sakte Hai And Practice Kar Sakte Hai.

Disclaimer

The Above Whole Problem Statement Is Given By Hackerrank.Com But The Solution Is Generated By The masterprograming.com Authority If Any Of The Query Regarding This Post Or Website Fill The Contact Us Form.

-Masterprogramming

Friends Mujhe Umeed Hai Ki Aapko HackerRank – Arithmetic Operators In Hindi   Ke Bare Mai 100% Jankari Ho Gayi Hogi | Agar Aapko Learn Karne Main Dikkat Aa Rahi Hai To Aap Mujhse Se Contact Kar Sakte Hai |

Leave a Reply

Your email address will not be published. Required fields are marked *