Answer:
int main() {
int n;
cout<<"Enter the integer n"<<endl;
cin>>n;
if(n<1 || n>10)
{
while(n>10 || n<1)//taking input if the number is not within range..
{
cout<<"Enter the number again"<<endl;
cin>>n;
}
activity(n);//calling activity with the n..
}
return 0;
}
Explanation:
Above written is the main function in which a prompting an integer between 1 and 10 if it is not within range then again taking input.Then after that calling activity with n as argument.
A sequence of one or more characters is called STRING.
Answer:
#include <stdio.h>
int main(void) {
char letterToQuit = '?';
int numPresses = 0;
printf("Press the %c key %d times to quit ", letterToQuit, numPresses);
return 0;}
Explanation:
in print statement %c is replaced by value of variable 'letterToQuit'and %d is replaced by value of variable 'numPresses'
Answer:
#include <stdio.h>
int main()
{
float afTest1[5] = {90, 30, 25, 45, 55};
for (int i = 0; i < 5; i++) {
printf("%f ", afTest1[i]);
}
return 0;
}
Explanation:
Initialize the elements of the array as 90, 30, 25, 45, 55
Create a for loop that iterates through the array
Inside the loop, print each element using printf function
The answer to the above question is:
d. all of the above