Saturday, September 13, 2014

c

1.  Program
#include
#include

void main()
{
   cout << "Hello World";
   return 0;
getch();
}

Output
            Hello World
2.  Program

#include 
#include
            extern int a, b;
extern int c;
extern float f;
  
void main ()
{
                        int a, b;
            int c;
            float f;
 
            a = 10;
            b = 20;
            c = a + b;
 
             cout << c << endl ;
 
            f = 70.0/3.0;
            cout << f << endl ;
 
            return 0;
 
getch();
}

Output
30
23.3333
 
3. Program
            #include 
            #include
            int g;
 
            int main ()
            {
    int a, b;
 
  a = 10;
  b = 20;
  g = a + b;
 
  cout << g;
 
  return 0;
 
getch(); 
}

Output
                        g:30
4. Program
#include 
#include
 
int g = 20;
 
void main ()
{
  int g = 10;
 
  cout << g;
 
        return 0;
  getch();
}

Output
               10
 
5. Program
#include 
#include
 
void main()
{
            const int  LENGTH = 10;
            const int  WIDTH  = 5;
            const char NEWLINE = '\n';
            int area;  
   
             area = LENGTH * WIDTH;
            cout << area;
             cout << NEWLINE;
             return 0;
 
   getch();
}

Output

                    50

No comments:

Post a Comment