0% found this document useful (0 votes)
20 views

Lab 1

The document contains 3 C programming questions that calculate basic math operations based on user input numbers. Each question includes code to prompt the user for input, perform calculations, and output results. The third question adds header information identifying the university, department, course, and semester before performing the same calculations.

Uploaded by

Sarah Ja
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

Lab 1

The document contains 3 C programming questions that calculate basic math operations based on user input numbers. Each question includes code to prompt the user for input, perform calculations, and output results. The third question adds header information identifying the university, department, course, and semester before performing the same calculations.

Uploaded by

Sarah Ja
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

First Question

#include <stdio.h> // Library //

void main()

printf("Qais Abu Hamad \n"); // print on the screen//

printf("ID 23591 \n");

printf("My birthday 5/1/1988 \n");

}
Second Question

#include <stdio.h> //library//

void main() // program that calculates two numbers enterd by the user //
{
int num1; // Declaration //

int num2; // Declaration //

int num3; // Declaration //

int num4; // Declaration //

int num5; // Declaration //

printf("Enter The First Number \n"); // ask the user to enter two nums//

scanf("%d", &num1); // creates a place to store the num entered by the user //

printf("Enter The Second Number \n");

scanf("%d", &num2);

num3=num1+num2; // equations defined //


num4=num1-num2;
num5=num1*num2;

printf("Summation %d \n", num3);


printf("Difference %d \n", num4);
printf("Multiplucation %d \n", num5);

}
Third Question

#include <stdio.h> // library//

void main() // same as pervious program but with AUS header //

int num1; // Declaration //

int num2; // Declaration //

int num3; // Declaration //

int num4; // Declaration //

int num5; // Declaration //


printf("American University of Sharjah \n"); // header//

printf(" School of Engineering \n"); // header//

printf("Mechanical Engineering Department \n") ; // header//

printf(" MCE 234 \n"); // header//

printf(" FALL 2009 \n"); // header//

printf("Enter The First Number \n");

scanf("%d", &num1);

printf("Enter The Second Number \n");

scanf("%d", &num2);

num3=num1+num2; // calculation //

num4=num1-num2;

num5=num1*num2;

printf("Summation %d \n", num3);

printf("Difference %d \n", num4);

printf("Multiplucation %d \n", num5);

You might also like