Haval1

Question 3

Jan 18th, 2019
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.66 KB | None | 0 0
  1. // sol-final-ex1.cpp : Defines the entry point for the console application.
  2. /*
  3. swap main with secondary diagonal bewteen a[4][4],b[4][4] using pointer concepts in (enters , swap , print)
  4. */
  5.  
  6. #include "stdafx.h"
  7. #include "iostream"
  8. using namespace std;
  9.  
  10. int main()
  11. {
  12.     float f = 0;
  13.     float k1 = 4, k2 = 5, n, i, fact = 1, x, k3 = 2, k4=5;
  14.     cout << "Enter Number of formula : ";
  15.     cin >> n;
  16.     cout << "Enter Value of X : ";
  17.     cin >> x;
  18.     for(i=1;i<=x;i++)
  19.         fact = fact*i;
  20.     for (i = 1;i <= n;i++) {
  21.         f += k1*fact / k4*x;
  22.         k4 = k2 - k3;
  23.         k4 *=k4;
  24.         k2 += 4;
  25.         k1 = (k1 * 3) + 5;
  26.         x = x * x;
  27.     }
  28.     cout << "The res : " << f << endl;
  29.     return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment