Answer:
This code is written in MATLAB.
function [result] = isPalindrome(array,length)
if length == 0 || length == 1 %if the array is empty or contains only one element, the array is a palindrome
result = 1;
else
for i = 1:length/2 %check all the elements forward and backward until the middle is reached
if array(i) ~= array(end+1-i)
result = 0;
return
end
end
result = 1;
end
Explanation: Please read the comments in the code. In MATLAB, Boolean values are 1 or 0 instead of True or False.
Answer:
You can use JavaScript, HTML, PHP and so forth.
Explanation:
Answer:
This code is written using C++
Comments are used for explanatory purpose
Program starts here
#include<iostream>
using namespace std;
int main()
{
int temp;
//Prompt user for input
cout<<"Enter temperature (in Celcius): ";
//Check if input is acceptable
while(!(cin>>temp))
{
cout << "That was invalid. Enter a valid digit: "<<endl;
cin.clear(); // reset the failed input
cin.ignore(123,'\n');//Discard previous input
}
//Check if temp is greater than 40
if(temp>40)
{
cout<<"It's extremely hot day today!";
}
else{//If otherwise
cout<<"It's not too hot!";
}
return 0;
}
//End of Program
Answer:
TV card, CD-R drive, Floppy Disk, Sound Card, and CD-ROM drive are examples of internal peripheral devices!(Basically hard drives and something like that)
Explanation:
Answer:
There are 2 correct answers,
- It is easily read by most software and hardware because it requires little processing.
- It can be used by programmers for source code files.