Tuesday 27 November 2012

Write a program that will calculate the sum of expension of cosx in Maclaurin Series.


// 1 - x^2/2! + x^4/4! - x^6/6! + - - - - - - - - - - upto so on


#include <iostream>
#include <math.h>  // for power fucntion
using namespace std;
int main()
{
double x_value,fact=1.0,term,sum=0,max_power;
int sign=1;
cout << "Welcome to The WORLD OF C++ PROGRAMING"<<endl;
cout << endl;
cout << "This Program will generate the Maclauren Series of cos(x)."<<endl;
cout << endl;
cout << "Which is cos(x)= 1 - x^2/2! + x^4/4! - x^6/6! +  - - - - - - - "<<endl;
cout << endl;
cout << "Enter the Value or X: ";
cin >> x_value;
cout << "Enter Maximum Power of series: ";
cin >> max_power;
for (int i=0;i<=max_power;i=i+2)
{
fact=1;
for(int j=1;j<=i;j=j+1)
{
fact=fact*j;
}
term=pow(x_value,i)/fact;  // usage of power fucntion
sum=sum+(term*sign);
sign*=-1;
}
cout << "Sum is of Series is: " << sum <<endl;
return 0;
}


Write a program that will calculate the sum of expension of sinx in Maclaurin Series.


// x - x^3/3! + x^5/5! - x^7/7! + - - - - - - - - - - upto so on

#include <math.h> // to perform power fucntion.....
#include <iostream>
using namespace std;
int main()
{
double x_value,fact=1.0,term,sum=0,max_power;
int sign=1;
cout << "Welcome to The WORLD OF C++ PROGRAMING"<<endl;
cout << endl;
cout << "This Program will generate the Maclauren Series of sin(x)."<<endl;
cout << endl;
cout << "Which is sin(x)= x - x^3/3! + x^5/5! - x^7/7! +  - - - - - - - "<<endl;
cout << endl;
cout << "Enter the Value or X: ";
cin >> x_value;
cout << "Enter Maximum Power of series: ";
cin >> max_power;
for (int i=1;i<=max_power;i=i+2)
{
fact=1;
for(int j=1;j<=i;j=j+1)
{
fact=fact*j;
}
term=pow(x_value,i)/fact; // power fucntion
sum=sum+(term*sign);
sign*=-1;
}
cout << "Sum is: " << sum <<endl;
return 0;
}

Keyboard shortcuts for Microsoft Word 2007

Ctrl + A ==> To selects all documents in current file/folder, or select all text in current document

Ctrl + B ==> To make the font Bold

Ctrl + C ==> To Copy text or item to clipboard

Ctrl + D ==> To display Font dialogue box

Ctrl + E ==> To perform Centre Alignment for selected text

Ctrl + F ==> To perform Find & Replace action on text within document

Ctrl + G ==> To display Go To dialogue box to go to a specific location in document

Ctrl + H ==> To display the Find & Replace dialogue box

Ctrl + I ==> to make the selected text Italic

Ctrl + J ==> To make the selected text/document in full Justification

Ctrl + K ==> To create Hyperlink in the document

Ctrl + L ==> To apply Left Alignment on selected text/document

Ctrl + M ==> To perform the Tab action

Ctrl + N ==> To create a New document

Ctrl + O ==> To Open the existing file from local drives

Ctrl + P ==> To display the Print dialogue box

Ctrl + R ==> To apply Right Alignment on selected text/document

Ctrl + S ==> To Save/Save As current file/document

Ctrl + U ==> To Underline the selected text

Ctrl + V ==> To Paste the text/item that was Cut/Copied before

Ctrl + X ==> To Cut the selected text/item

Ctrl + Y ==> To Redo last performed action

Ctrl + Z ==> To Undo last performed action

Ctrl + Enter ==> To insert a Page Break

Ctrl + F1 ==> To quickly hide the toolbar and ribbon bar of current document

Ctrl + F2 ==> To display the Print Preview

Ctrl + F4 ==> To close the active document window only

Ctrl + F6 ==> To make the next document window active

F1 ==> To get Word Help

F2 ==> To move selected text/item to new location

F3 ==> To insert Auto Text entry

F4 ==> To repeat the last action

F5 ==> Another shortcut to Find & Replace dialogue box

F6 ==> To go to next frame or pane quickly

F7 ==> To launch and apply the Spelling & Grammar check

F8 ==> To extend the current selection in both sides

F9 ==> To update the selected fields

F10 ==> To activate menu bar

F11 ==> To go to the next field

F12 ==> another shortcut to Save As a file/document

Shift + F1 ==> To open context sensitive help

Shift + F2 ==> To copy text/item to the new location quickly

Shift + F3 ==> To change the case of selected text

Shift + F4 ==> Another shortcut to perform Find and Go To action

Shift + F5 ==> To move to previous revision

Shift + F6 ==> To go to previous frame or pane

Shift + F7 ==> To launch Thesaurus

Shift + F8 ==> To shrink the current selection of text

Shift + F9 ==> To switch between a field code and its result

Shift + F10 ==> To display shortcut menu (similar to right-click)

Shift + F11 ==> To go to previous field

Shift + F12 ==> To Save document

Friday 23 November 2012

Code to calculate the sum of series 1/2!+2/3!+3/4!+4/5!+5/6!+ - - - - - -



#include <iostream>
using namespace std;
int main()
{
double fact,term,sum=0;
int length;
cout << "This program will disply the sum of following series... \n"<<endl;
cout << "1/2!+2/3!+3/4!+4/5!+5/6!+ - - - - - - \n"<<endl;
cout << "Enter Length of the series: ";
cin >> length;
for (int i=1;i<=length;i++)
{
fact=1;
for (int j=1;j<=i+1;j++)
{
fact=fact*j;
}
term=i/fact;
sum=sum+term;
}
cout << "Sum is: "<< sum << endl;
cout <<endl;

return 0;
}

Sum of series 1/1!+2/2!+3/3!+4/4!+5/5! + - - - - - - -


Write a program to calculate the sum of the following series:
1/1!+2/2!+3/3!+4/4!+5/5!+6/6!+ - - - - - - -




#include <iostream>
using namespace std;
int main()
{
 double fact,term,sum=0;
 int length;
 cout << "This program will disply the sum of following series... \n"<<endl;
 cout << "1/1!+2/2!+3/3!+4/4!+5/5!+ - - - - - - \n"<<endl;
 cout << "Enter Length of the series: ";
 cin >> length;
 for (int i=1;i<=length;i++)
 {
  fact=1;
  for (int j=1;j<=i;j++)
  {
   fact=fact*j;
  }
  term=i/fact;
  sum=sum+term;
 }
  cout << "Sum is: "<< sum << endl;
  cout <<endl;

 return 0;
}

}



Pattern print With Nested for loop


Write a program that will display the following pattern using nested for loop
1
12
123
1234
12345

#include <iostream>
using namespace std;
int main()
{
for (int i=1;i<=5;i++)
{
     for (int j=1;j<=i;j++)
     cout << j;
cout <<endl;
}
return 0;
}

Pattern with Nested For Loop


Write a program that will display the following patter using nested for loop....
1
22
333
4444
55555
  
#include <iostream>
using namespace std;
int main()
{
for (int i=1;i<=5;i++)
{ for (int j=1;j<=i;j++)
cout << i;
cout <<endl;
}
return 0;
}