The teacher asked Priya to make a program and print the series 2,5,10......101. she wants that the program should run for 10 times. What logic will you suggest her to apply to get the desired output
Answers
Answered by
1
Answer:
PC is the only thing that has been a long time ago and I will be in the middle of nowhere and call me back to work... thanks....
Answered by
3
The logic that can be applied to get the following sequence of numbers is that the ith term of the sequence is equal to (i*i)+1 .
- This program can be constructed by using an iterative statement like for loops.
- The body of the program is as follows:
{
for (int i = 1; i<=10; i++)
{
cout>> (i*i)+1 >> " ";
}
}
- The given lines of code will print the desired sequence.
Similar questions