Adding 2 numbers – (Declaring integer variables, Watching Variables)

0002-ADDING 2 integers , 5 and 6 no output

Exercise 1 

  1. Write code which declares 2 integer variables A and B .  Initialize A to 5 and B to 6.  Use a third variable , C to store the result of A+B.  

  2. Verify addition has occurred by using the variable watch window.

Demonstration Video

https://youtu.be/nfGwWUIZDaY

Download the files here: https://drive.google.com/file/d/15PfdndUqvnd_fLYPzctsgZMG4I9oSYtx/view?usp=sharing

Code

#include <stdio.h>
#include <stdlib.h>

int main()
{
   //declare and identify variables
   int a,b;
   int c;

   //Initialize the variables
   a=5;
   b=6;

   //Perform processing c <-- a+b
   c=a+b;


}

© 2021  Vedesh Kungebeharry. All rights reserved. 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s