Subtracton table

Description:

Write a program to display the subtraction table Test Case 1 Input (stdin) 7 13 Expected Output 7 - 1 = 6 7 - 2 = 5 7 - 3 = 4 7 - 4 = 3 7 - 5 = 2 7 - 6 = 1 7 - 7 = 0 7 - 8 = -1 7 - 9 = -2 7 - 10 = -3 7 - 11 = -4 7 - 12 = -5 7 - 13 = -6 Test Case 2 Input (stdin) 8 12 Expected Output 8 - 1 = 7 8 - 2 = 6 8 - 3 = 5 8 - 4 = 4 8 - 5 = 3 8 - 6 = 2 8 - 7 = 1 8 - 8 = 0 8 - 9 = -1 8 - 10 = -2 8 - 11 = -3 8 - 12 = -4

Program :

#include <iostream>

using namespace std;

int main()

{

int n,a,i;

  cin>>n>>a;

  for(i=1;i<a+1;i++)

  cout<<n<<" - "<<i<<" = "<<(n-i)<<"\n";

return 0;

}