Terms of AP
Terms of AP
Send Feedback
Terms of AP
Integer x
Terms of series (separated by space)
1 <= x <= 1,000
10
5 11 14 17 23 26 29 35 38 41
4
5 11 14 17
#include<iostream>using namespace std;/*int main() { // Write your code here /*int n; cin>>n; int count =0; int i=1; //bool t_term=true; while(count<n){ int term =3*i+2; i++; if(term%4==0){ //t_term=false; continue; } else{ cout<<term<<" "; count++; } }
}*/int main() {int n;cin>>n;int count=0;for(int i=1;n>count;i++){ int term=3*i+2; if(term%4==0){ continue; } else{ cout<<term<<" "; count++; } }
}
Comments
Post a Comment