<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<!DOCTYPE html>
<html>
<body>
<h2>task-2</h2>
enter the value :
<input id="demo1" type="text"><br><br>
<span id="demo2">Hiii</span><br><br>
<button onclick="method()">click</button><br><br>
Enter id :<input id="demo3" type="number"><br><br>
<button onclick="method2()">click</button><br><br>
index Number is :<span id="fn">h</span>
<script>
function method(){
var x=document.getElementById("demo1").value;
var q="";
var i;
for(i=0;i<x;i++)
{
q+='<p id='+i+'> '+ (i+10) +' </p>';
}
document.getElementById("demo2").innerHTML=q;
}
function method2(){
var x1=document.getElementById("demo3").value;
var ann=document.getElementById(x1).innerHTML;
//alert(ann);
document.getElementById("fn").innerHTML=ann;
}
</script>
</body>
</html>