Computer Science, asked by swati0325, 19 days ago

Write a program where a function motto() displays the text "In God we Trust" through another function main (), call motto() as many times as the user wants.

Solve this in java..
and pls no spam..​

Answers

Answered by priyanshukrgupta043
1

Answer:

class God

{

void motto()

{

System.out.println("In God we trust");

}

void motto( int n)

{

for(int i=1;i<=n;i++)

System.out.println(""+motto());

}

public static void main (string args [])

{

Scanner SC= new Scanner (System.in);

int n;

System.out.println(" Enter the number");

n=SC.nextInt();

God uo = new God();

uo.motto(n);

}

}

Similar questions