PROGRAMS DESCRIBED IN DAY 4 VIDEO ON YOUTUBE


Program 1 : Hello World Program

// Program to display hello world on screen


#include<iostream.h>

#include<conio.h>


void main()

{

  clrscr();

  cout<<"Hello World";

  getch();

}


Program 2 : Program for addition of two numbers


// Program to display addition of two numbers


#include<iostream.h>

#include<conio.h>

void main()

{

  int a,b,c;

  clrscr();

  cout<<"Enter two numbers :";

  cin>>a>>b;

  c=a+b;

  cout<<"Addition is "<<c;

  getch();

}

Program 3 : Program to find smallest among three numbers

// Program to find smallest among three numbers


#include<iostream.h>

#include<conio.h>

void main()

{

  int a,b,c,min;

  clrscr();

  cout<<"Enter three numbers :";

  cin>>a>>b>>c;

  min=a;

  if(b<min)

     min=b;

  if(c<min)

     min=c;

  cout<<"Smallest value is "<<min;

  getch();

}

Program 4 : Program to check whether given number is divisible by 7 or not

// Program to check whether given number is divisible by 7 or not


#include<iostream.h>

#include<conio.h>

void main()

{

  int n;

  clrscr();

  cout<<"Enter one number :";

  cin>>n;

  if(n%7==0)

     cout<<"Yes...Number is divisible by 7";

  else

     cout<<"No....Number is not divisible by 7";

  getch();

}

Program 5 : Program to check whether given odd number is divisible by 7 or not

// Program to display whether given odd number is divisible by 7


#include<iostream.h>

#include<conio.h>

void main()

{ int n;

  clrscr();

  cout<<"Enter any number :";

  cin>>n;

  if(n%2==1)

  {

    cout<<"Number is odd ";

    if(n%7==0)

       cout<<"And it is divisible by 7";

    else

       cout<<"But it is not divisible by 7";

  }

  else

     cout<<"Number is not odd";

  getch();

}

Video




Comments

Popular posts from this blog

INTRODUCTION TO LANGUAGES

DECISION MAKING STATEMENTS IN C