trickbd

Output a string for many times in Java , C programming, JavaScript & Php

Here I am providing source code of a prograam.. By using this you can get the out put of a single input string for many times.You can do it by using a single for loop. So let’s Start

 

#Java

package Practice;

public class StringGenarate {

public static void main(String[] args) {
int n=100;
for (int i = 0; i < n; i++) {
System.out.println(“Here you need to give your input”);
}

}

}

 

#C_Programming

#include <stdio.h>
int main(){
int n=100;
int i=0;
for(i=0;i<n;i++){
printf(“Here you need to give your input\n”);
}
return 0;
}

 

#JavaScript

<!DOCTYPE html>
<html>
<body>

<p>It will excute the text for 100 times</p>

<p id=”demo”></p>

<script>
var text = “”;
var i;
for (i = 0; i < 100; i++) {
text += “Here you need to give your input <br>”;
}
document.getElementById(“demo”).innerHTML = text;

</script>

</body>
</html>

 

#Php

<?php
$n=0;
$txt=”Here you need to give your input<br/>”;
for($n=0;$n<100;$n++){
echo $txt;

}
?>

 

NB:Change the value of variable “n” 100 to how much output you want!

Output:

Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input
Here you need to give your input