+ 1

How can we print negative number series in c++

10th Sep 2018, 6:26 AM
Adil Hussain
Adil Hussain - avatar
2 Answers
+ 4
#include <iostream> using namespace std; int main() { for(int i = 1; i <= 100; i++) cout << i * (-1) << endl; return 0; }
10th Sep 2018, 6:54 AM
blACk sh4d0w
blACk sh4d0w - avatar
+ 2
For this, you have to use loop. Your loop may start from -1 and decrement it one by one example- x = x-1. The loop should have a range upto which the loop executes.
10th Sep 2018, 6:51 AM
Jakariya Bin Hamza
Jakariya Bin Hamza - avatar