The nursing usually takes up to 18 months, i.e. one year and a half.
The baby dolphin may however remain with his mum for up to 3-6 years.
Answer:
The code will display the following on the screen:-
2
0
2
Explanation:
The output is like this because x{2} assigns the value 2 to the integer x.First the value of x is printed on the screen that is 2 and that newline is used to go to the next line.After that function is called doSomething with x passed as the argument. doSomething function assigns the value zero to the variable passed and prints it on the screen.So the next line is 0.Since x is passed by value so no changes will appear in the original argument.Hence the last line printed is 2.
Answer:
public class Triangle
{
public static void main( String[] args )
{
show( 5 );
}
public static void show( int n )
{
int i,j,k;
for (i = 0; i < n - 1; i++ )
{
for (j = 0; j < i; j++ )
{
System.out.print( " " );
}
for (k = n - i; k > 0; k-- )
{
System.out.print( "* " );
}
System.out.println();
}
for (i = 0; i < n; i++ )
{
for (j = n - i; j > 1; j-- )
{
System.out.print( " " );
}
for (k = 0; k < i + 1; k++ )
{
System.out.print( "* " );
}
System.out.println();
}
Answer:
#include <iostream>
#include <cstring>
using namespace std;
bool isAPalindrome(char* palindrome);
int main()
{
char palindrome[30];
bool palindrome_check;
cout << "Please enter an word or phrase.\n";
cin.getline(palindrome, 30);
palindrome_check = isAPalindrome(palindrome);
if (palindrome_check = true)
{
cout << "Input is a palindrome\n";
}
else
{
cout << "Inputis not a palindrome\n;";
}
system("pause");
return 0;
}
bool isAPalindrome(char* palindrome)
{
char* front;
char* rear;
front = palindrome;// starts at the left side of the c string
rear = (palindrome + strlen(palindrome)) - 1;//starts at the right side of the c-string. adds the c string plus the incriment value of s
while (front <= rear)
{
if (front = rear)
{
front++;
rear--;
}
else
{
return false;
}
}
return true;
}