Opening attachments or links from unknown or spoofed emails. note: shown above are two examples of how viruses can often appear as legitimate messages, but are designed to trick the computer user. ...
Downloading software from malicious sites. ...
Online Ads. ...
Social media. ...
Unpatched software.
follow me
Answer:
#include <iostream>
#include <cstdlib>
using namespace std;
char grade(double marks){
if(marks>=90)
{
return 'A';
}
else if (marks >=80 && marks<90)
{
return 'B';
}
else if (marks >=70 && marks<80)
{
return 'C';
}
else if (marks >=60 && marks<70)
{
return 'D';
}
else if ( marks<60)
{
return 'F';
}
}
int main()
{
double marks;
cout <<"Ener marks";
cin >>marks;
char grd=grade(marks);
cout<<"Grae is "<<grd;
return 0;
}
Explanation:
Take input from user for grades in double type variable. Write function grade that takes a parameter of type double as input. Inside grade function write if statements defining ranges for the grades. Which if statement s true for given marks it returns grade value.
In main declare a variable grd and store function returned value in it.
Answer:
The answer is the last option
import java.util.*;
public class myClass {
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
System.out.print("Input a String: ");
String str = scan.nextLine();
System.out.print("Input an integer: ");
int num = scan.nextInt();
for(int i=str.length()-1; i>=0; i--) {
for(int j=0; j<num; j++) {
System.out.print(str.charAt(i));
}
}
}
}
Answer:
public class Main {
public static void main(String[] args)
{
int n,m;
int k=5;
for(n=1;n<=k;n++)
{
for(m=1;m<=n;m++)
System.out.print(m);
System.out.print(" ");
}
}
}
Explanation:
The solution to this problem is the use of nested loops of an inner and outer loop to generate a half pyramid of numbers, but displayed on the same line so we have a sequence 1 12 123 1234 12345. The outer loop iterates for n=1 to n<=5 and the inner loop that has the print statement prints the integers from for m = 1 to m<=n.
Note that the value k = 5 is hard coded which in some sense is the number of rows, that is the length of iteration of the outer loop.