Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Homework 1 This homework will help you learn how to run a C program and visualize the output To Do First: How to run a C program 1. Watch the Video about how to run a C program in Visual studio. 2....

1 answer below »

Homework 1
This homework will help you learn how to run a C program and visualize the output
To Do First: How to run a C program
1. Watch the Video about how to run a C program in Visual studio.
2. Watch the video about how to run a C program using the online compile
Exercise 1: What is the output of the following code.
Use any of the steps in “To Do First” to run the following code and take a screen shot of the output and
paste it in a word document.
#include
int main()
{
printf("Name : Alexandra A
amov\n");
printf("DOB : July 14, 1975\n");
printf("Mobile : XXXXXXXXXXn");
return(0);
}
Exercise 2: What is the output of the following code.
Use any of the steps in “To Do First” to run the following code and take a screen shot of the output and
paste it in a word document.
#include
int main()
{
printf("######\n");
printf("#\n");
printf("#\n");
printf("#####\n");
printf("#\n");
printf("#\n");
printf("#\n");
return(0);
}

Homework 2
This homework will help you learn how to run a C program and visualize the output
To Do First: How to run a C program
1. Watch the Video about how to run a C program in Visual studio.
2. Watch the video about how to run a C program using the online compile
Exercise 1: What is the output of the following code.
Use any of the steps in “To Do First” to run the following code and take a screen shot of the output and
paste it in a word document.
**
* C program to convert temperature from degree fahrenheit to Celsius
*
#include int main()
{
float celsius, fahrenheit;
/* Input temperature in fahrenheit */
printf("Enter temperature in Fahrenheit: ");
scanf("%f", &fahrenheit);
/* Fahrenheit to celsius conversion formula */
celsius = (fahrenheit - 32) * 5 / 9;
/* Print the value of celsius */
printf("%.2f Fahrenheit = %.2f Celsius", fahrenheit, celsius);
return 0;
}
Exercise 2: What is the output of the following code.
Use any of the steps in “To Do First” to run the following code and take a screen shot of the output and
paste it in a word document.
**
* C program to convert days in to years, weeks and days
*
#include int main()
{
int days, years, weeks;
/* Input total number of days from user */
printf("Enter days: ");
scanf("%d", &days);
/* Conversion */
years = (days / 365);
Ignoring leap year
weeks = (days % 365) / 7;
days = days - ((years * XXXXXXXXXXweeks * 7));
/* Print all resultant values */
printf("YEARS: %d\n", years);
printf("WEEKS: %d\n", weeks);
printf("DAYS: %d", days);
return 0;
}

1

Homework 3
To Do First: How to run a C program
1. Watch the Video about how to run a C program in Visual studio.
2. Watch the video about how to run a C program using the online compile
Exercise 1: What is the output of the following code.
Use any of the steps in “To Do First” to run the following code and take a screen shot of the output and
paste it in a word document.
#include

int sum (int, int);
function declaration
int main (void)
{
XXXXXXXXXXint total;
printf("\n\n Function : a simple structure of function :\n");
printf("----------------------------- XXXXXXXXXXn");
XXXXXXXXXXtotal = sum (5, 6);
function call
XXXXXXXXXXprintf ("The total is : %d\n", total);
XXXXXXXXXXreturn 0;
}

int sum (int a, int b)
function definition
{
int s;
s=a+b;
XXXXXXXXXXreturn s;
function returning a value
}
2

Exercise 2: What is the output of the following code.
Use any of the steps in “To Do First” to run the following code and take a screen shot of the output and
paste it in a word document.

*
* Write a program in C to find the square of any number using the function.
*/

#include

double square(double num)
{
return (num * num);
}

int main()
{
int num;
double n;
printf("\n\n Function : find square of any number :\n");
printf("----------------------------- XXXXXXXXXXn");

printf("Input any number for square : ");
scanf("%d", &num);
n = square(num);
printf("The square of %d is : %.2f\n", num, n);
return 0;
}
Exercise 3:
Ex3.c: Write a C program to print a block E using hash (#). Your program is expected to look like the
following:
######
#
#
######
#
#
######



Homework 5:
Chapter 5: Repetition and Loop Statements

Exercise 1: What is the output of the following code? This program in C display the first 10
natural numbers.
#include
void main()
{
int i;
printf("The first 10 natural numbers are:\n");
for (i=1;i<=10;i++)
{
printf("%d ",i);
}
printf("\n");
}
Exercise 2: What is the output of the following code. Write a C program to find the sum of
first 10 natural numbers.
#include
void main()
{
int j, sum = 0;
printf("The first 10 natural number is :\n");
for (j = 1; j <= 10; j++)
{
XXXXXXXXXXsum = sum + j;
XXXXXXXXXXprintf("%d ",j);
}
printf("\nThe Sum is : %d\n", sum);

}

Exercise 3: What is the output of the following code? This C program accepts two integers and
check whether they are equal or not.
#include
void main()
{
int int1, int2;
printf("Input the values for Number1 and Number2 : ");
scanf("%d %d", &int1, &int2);
if (int1 == int2)
XXXXXXXXXXprintf("Number1 and Number2 are equal\n");
else
XXXXXXXXXXprintf("Number1 and Number2 are not equal\n");
}

Exercise 4: What is the output of the following code?
* FIGURE 5.8 Displaying a Celsius-to-Fahrenheit Conversion Table */
* Conversion of Celsius to Fahrenheit temperatures */

#include
* Constant macros */
#define CBEGIN 10
#define CLIMIT -5
#define CSTEP 5

int
main(void)
{
/* Variable declarations */
int celsius;
double fahrenheit;

/* Display the table heading */
printf(" Celsius Fahrenheit\n");

/* Display the table */
for (celsius = CBEGIN;
XXXXXXXXXXcelsius >= CLIMIT;
XXXXXXXXXXcelsius -= CSTEP) {
XXXXXXXXXXfahrenheit = 1.8 * celsius + 32.0;
XXXXXXXXXXprintf("%6c%3d%8c%7.2f\n", ' ', celsius, ' ', fahrenheit);
}
return (0);
}
Exercise 5: What is the output of the following code?

* FIGURE 5.4 Program to Compute Company Payroll */
* Compute the payroll for a company */
* This exercise computes the Company Payroll. */

#include

int
main(void)
{
double total_pay; /* company payroll */
int count_emp; /* cu
ent employee */
int number_emp; /* number of employees */
double hours; /* hours worked */
double rate; /* hourly rate */
double pay; /* pay for this period
Answered 18 days After Apr 07, 2022

Solution

Rakthi answered on Apr 26 2022
87 Votes
Homework 1
Exercise 1
Exercise 2
Homework 2
Exercise 1
Exercise 2
Homework 3
Exercise 1
Exercise 2
Exercise 3
Homework 5
Exercise 1
Exercise 2
Exercise 3
Exercise 4
Exercise 5
Homework 6
Exercise 1
Exercise 2
Exercise 3
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here