Posts

Showing posts from March, 2014

to be happy

  सुखी होने के दस उपाय। ..........  १. काम में सदैव  व्यस्त रहो।  २. अपनी क्षमता को पहिचानो।  ३. कभी कभी न बोलना भी सीखो।  ४. अपनी गलती स्वीकार करो।  ५. व्यवहारीक  बनो।  ६. सबको राय लेकर निर्णय लो।  ७. आए से जादा ख़र्च न करो।  ८. गहराई  से सोचो फिर बोलो।  ९. प्रतिक्षा  में धीरज रखो।  १०. सबको सम्मान से बुलाओ।    दुखी होने के दस कारण। ……………… १. देरी  से सोना और देरी से उठाना।   २.कोई  भी काम समय से न करना।  ३. किसीका भी विशवास न करना।   ४. सव्य  की  बात को ही सत्य बताना।  ५. कीसीके लिए कुछ  न करना।  ६. हमेशा सव्य  के लिए ही सोचना।  ७. लेन देन  का हिसाब ना रखना।  ८. बिना कारन झ़ुठ बोलना।  ९. बिना मांगे सलाह देना।  १०. भुतकाल  के  सुख  को बहुत याद  करना।   

Pointers and void pointer and precedence of & and * operators in pointers.

Pointers Definition:- A pointer is a variable that stores the memory address of another another variable. void pointer :-( it can contain address of any data type ) syntax:-    void *pointer_name; example:- void *v_ptr; A void pointer does not have any data-type associated it with and can contain the address of any type of variable. example:- void v_ptr;                 char ch;                  int i;                  float fvar;                  v_ptr= &ch;                  v_ptr= &i;             ...

Program of magic. magic.cpp

#include<iostream.h> #include<conio.h> int main() {         int i,ans=0;     clrscr();     cout<<"\nChoose one number in your mind from 1 to 63 \n";     cout<<"\n1    3    5    7    9    11    13    15 \n";     cout<<"\n17    19    21    23    25    27    29    31 \n";     cout<<"\n33    35    37    39    41    43    45    47 \n";     cout<<"\n49    51    53    55    57    59    61    63 \n";     cou...

Program to find GCD of two numbers

#include<iostream.h> int main() { int first_number,second_number,gcd,i; cout<<"Enter First Number : "; cin>>first_number; cout<<"Enter Second Number: "; cin>>second_number; for(i=1;i<=first_number&&i<=second_number;i++) {      if(first_number%i==0 && second_number%i == 0 ) {                      gcd=i;     } } cout<<"Greatest Common Division (GCD):"<<gcd<<endl; return 0; } ******Output****** Enter First Number: 9 Enter Second Number: 24 Greatest Common Division (GCD):3  What is GCD of two numbers?  It means a greatest number which divides both numbers For example: Two numbers are 9 and 24 Numbers which divides both are 1 and 3 in which greatest number is 3 So 3 is the GCD of 9 and 24 Click here for more programs on C++

Program in C++ to count heart beats of a person by its age from born

# include <iostream.h> int main() { int age,heartbeats; cout<<"Enter Age: "; cin>>age; cout<<"Enter Number of Heartbeats per min: "; cin>>heartbeats; heartbeats = heartbeats * 60; //heartbeats per hour heartbeats = heartbeats * 24; //heartbeats per day heartbeats = heartbeats * 365; //heartbeats per year cout<<"Your Heart has beat "<<heartbeats * age<<" times since you were born."<<endl; return 0; } -----------------------OUTPUT---------------------  Enter Age: 26  Enter Number of Heartbeats per min: 70  Your Heart has beat  956592000  times since you were born.

Program in C++ for Fibonacci Series using recursion function

#include<iostream.h> fibonacci(int);            //function prototype void main() { int n,i,f; cout<<"Enter the total elements in the series : "; cin>>n; cout<<"\nThe Fibonacci series is:\n"; for(i=0;i<n;i++)     {         f=fibonacci(i); //function call         cout<<f<<"  ";     } } fibonacci(int n)        //function definition {     int f;     if(n==0)     return 0;     else if(n==1)     return 1;     else     f=fibonacci(n-1)+fibonacci(n-2);  /*Two recursion function calling itself with different arguments.*/     return f; } -----------------OUTPUT--------------- Enter the total elements in the series :  7 The Fibon...

Using power function display armstrong number

#include<iostream.h> #include<math.h> int main() { int sum,n,temp,rem; cout<<"The Armstrong number between the range 1 to 500 are : \n";  for(int x=1;x<=500;x++) { n=x; sum=0; temp=n; do { rem=n%10; n=n/10; int p; p=pow(rem,3); sum=sum+p; }while(n!=0); if(sum==temp) cout<<x<<"\t"; } cout<<"\t"; return 0; } Output: The Armstrong number between the range 1 to 500 are :  1      153     370     371     407  

Program to dispaly armstrong number between 1 to 500

#include<iostream.h> int main() { int sum,n,temp,rem; cout<<"The Armstrong number between the range 1 to 500 are : \n";  for(int x=1;x<=500;x++) { n=x; sum=0; temp=n; do { rem=n%10; n=n/10; sum=sum+rem*rem*rem; }while(n!=0); if(sum==temp) cout<<x<<"\t"; } cout<<"\t"; return 0; } Output:  The Armstrong number between the range 1 to 500 are : 1        153         370       371        407

C++ Program to check whether number is Armstrong number

#include<iostream.h> int main() {       int sum,temp,rem,n;      cout<<"Enter the number \n";      cin>>n;      cout<<" Entered number is \t";      cout<<n;      cout<<"\n";      sum=0;       temp=n;       do         {                 rem=n%10;                 n=n/10;                 sum=sum+rem*rem*rem;            }while(n!=0);      if(sum==temp)             cout<...