Answer:
The codes below implement the problem statements
Explanation:
public class Percentages {
public static void computePercent (int a,int b)
{
System.out.println(a+" is "+(a*100/b)+"% of "+b);
}
public static void main(String []args)
{
int a=2;
int b=5;
computePercent(a,b);
computePercent(b,a);
}
}
<u>
</u>
<u>Part(b)
</u>
import java.util.*;
public class Percentages {
public static void computePercent (int a,int b)
{
System.out.println(a+" is "+(a*100/b)+"% of "+b);
}
public static void main(String []args)
{
Scanner s= new Scanner(System.in);
int a=s.nextInt();
int b=s.nextInt();
computePercent(a,b);
computePercent(b,a);
}
}
Answer:
// This program is written in C++
// Comments are used for explanatory purpose
// Program starts here
#include<iostream.h>
#include<stdlib.h>
int main()
{
// Declare variables
int num, selectno;
string status;
randomize();
//Generate random number;
num=rand()%10000;
// Prompt to guess a number
cout<<"You have only 10 tries\nTake a guess: ";
int tries = 0;
while (tries != 10)
{
cin>>selectno;
if(selectno == num){
cout<<"You passed at the "<<count+1<<" attempt";
tries = 10;
}
else
{
cout<<"You failed. Take another guess\n You have "<<10 - count + 1 <<" attempts";
}
tries++;
if(tries >= 10)
{
break;
}
}
return 0;
}
See how long I can hold the key down. I forgot there was a max :/
hiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
Answer:
Is it a tool in the computer, pls make it clear
1 is A
2 is probably C or B but I don't use Unity so I can't help much with that one.