Answer:
// A optimized school method based C++ program to check
// if a number is composite.
#include <bits/stdc++.h>
using namespace std;
bool isComposite(int n)
{
// Corner cases
if (n <= 1) return false;
if (n <= 3) return false;
// This is checked so that we can skip
// middle five numbers in below loop
if (n%2 == 0 || n%3 == 0) return true;
for (int i=5; i*i<=n; i=i+6)
if (n%i == 0 || n%(i+2) == 0)
return true;
return false;
}
// Driver Program to test above function
int main()
{
isComposite(11)? cout << " true\n": cout << " false\n";
isComposite(15)? cout << " true\n": cout << " false\n";
return 0;
}
Explanation:
Answer:
a. 1 is a packet, 2 is data, 3 is a frame.
Explanation:
And what is not mentioned is segment which used TCP/UDP and is part of Transport layer. The packet carries the destination and sender IP address, and is part of the Network Layer. The frame has the Mac address of destination device and senders device and is part of data link layer.
Hence segment has no IP address, hence b. is not correct. Also, data cannot have the IP Address, and Frame has the MAC address, Hence, the above answer. And this arrangement is part of Data Encapsulation.
Also keep in mind data can be anything like a series of bits, or any and it can or not have a header.
Explanation:
This is easily solvable with a for loop. Something like:
(I assume c++)
#include <iostream>
#include <string>
int main() {
take_input: //tag
std::string input;
cin >> input; //take the input
int spaceCount = 0;
char checking;
for(unsigned int i = 0; i == input.length(); ++i) {
checking = spaceCount[i];
if(checking == ' ')
spaceCount++;
}
if(spaceCount >= 1 && input.length >= 5)
std::cout << "Your name is " + input;
else
goto take_input; // reasks for input if the conditions are not met
return 0;
};
**remove all spaces before using the code, the if statements are messed up
Answer:
hi sorry for not knowing the answer
but please follow have a great day,night, or afternoon