In this problem, we need to find the next sequence of give AP or GP series. If a2-a1 == a3-a2, then its a AP series, otherwise its a GP series. */
| 7 | If a2-a1 == a3-a2, then its a AP series, otherwise its a GP series. |
| 8 | */ |
| 9 | int main() |
| 10 | { |
| 11 | jaadu; |
| 12 | uli a1,a2,a3; |
| 13 | cin>>a1>>a2>>a3; |
| 14 | while(a1!=0 || a2 !=0 || a3 !=0){ //Loop until the End of input (denoted by 0 0 0) |
| 15 | |
| 16 | if((a2-a1)==(a3-a2)){ //Check for AP Series |
| 17 | cout<<"AP "<<a3 + (a3-a2)<<endl; //Print next AP Seq |
| 18 | } |
| 19 | else{ //GP Series |
| 20 | cout<<"GP "<<a3*(a3/a2)<<endl; //Print next GP Seq |
| 21 | } |
| 22 | cin>>a1>>a2>>a3; |
| 23 | } |
| 24 | return 0; |
| 25 | } |
nothing calls this directly
no outgoing calls
no test coverage detected