1. Using the online compiler (or Dev C++):-
• Enter the code from the file operators.c https://vle.dmu.ac.uk/bbcswebdav/pid-5463722-dt-content-rid-10886002_1/courses/ENGD1025_2122_520/operators%281%29.c
• Add this source code to your logbook.
• Run the program. You will be prompted to enter integer values for a and b. Enter 4 for a, and 5 for b.
• Add the output of this program to your logbook
• Write a short reflective account of the code concentrating on its functionality and comparing the outputs against the source code.
#include <stdio.h>
int main()
{
//declare a and b variables
int a;
int b;
//enter the value of a
printf("\nEnter a: ");
scanf("%d",&a);
//enter the value of a
printf("\nEnter b: ");
scanf("%d",&b);
int sum;
sum=a+b;
printf("\nThe sum of %d and %d = %d",a,b,sum);
//a=4; b=5
//Output
//The sum of a and 5 = 9
return 0;
}
Comments
Leave a comment