Your Perfect Assignment is Just a Click Away
We Write Custom Academic Papers

100% Original, Plagiarism Free, Customized to your instructions!

glass
pen
clip
papers
heaphones

Assignment: C Programming

Assignment: C Programming

C Programming
1. Problem Statement
Write a C Program – using if else statements, to find the largest number among the given two integer numbers. –

Instructions

· Write comment to make your programs readable.

· Use descriptive variables in your programs (Name of the variables shou ld show their purposes).

· Ensure your code compiles without any errors/warning/deprecations

· Avoid too many & unnecessary usage of white spaces (newline, spaces, tabs, …)

· Try to retain the original code given in the exercise, to avoid any issues in compiling & running your programs

· Always test the program thoroughly, before saving/submitting exercises/project

Hints/Tips

#include<—>

int main()

{

if ( x > y )

{

printf ();

}

else

{

printf ();

}

}

Expected Output

Enter the values for x and y Input: 250 350 Output: Y is large number – 350

Close

2. Problem Statement
Write a C Program to extract a portion of a string from a character string.

Instructions
-Write comment to make your programs readable. -Use descriptive variables in your programs (Name of the variables shou ld show their purposes). – Ensure your code compiles without any errors/warning/deprecations – Avoid too many & unnecessary usage of white spaces (newline, spaces, tabs, …) – Try to retain the original code given in the exercise, to avoid any issues in compiling & running your programs – Always test the program thoroughly, before saving/submitting exercises/project

Hints/Tips
include< ———- >
void main()
{
l=strlen(str1);
if(m+n-1

3.

Problem Statement
a) Write a C program, to find both the largest and smallest number in a list of integers using an Array. b) Write a C program, to add two matrices using an Array. c) Write a C program, to multiply two matrices using an Array.

Instructions
· Write comment to make your programs readable.

· Use descriptive variables in your programs (Name of the variables shou ld show their purposes).

· Ensure your code compiles without any errors/warning/deprecations

· Avoid too many & unnecessary usage of white spaces (newline, spaces, tabs, …)

· Try to retain the original code given in the exercise, to avoid any issues in compiling & running your programs

· Always test the program thoroughly, before saving/submitting exercises/project

Hints/Tips
include void main() { variables; printf(“n =====Matrix Addition=====n”); for(i=0;i<2;i++) { for(j=0;j<2;j++) { //logic } } printf(“n =====Matrix Multiplication=====n”); for(i=0;j<2;j++) { for(j=0;j<2;j++) { for(k=0;k<2;k++) { //logic } } } }

Expected Output
a) Enter the max no of array elements: 4 enter the array elements 43 34 45 54 The maximum number in given array is: 54 The minimum number in given array is: 34 b) Enter elements of matrix A:1 2 3 4 Enter elements of matrix B:1 2 3 4 ===== Matrix Addition ===== 2 4 6 8 c) Enter elements of matrix A: 1 2 3 4 Enter elements of matrix B: 1 2 3 4 ===== Matrix Multiplication ===== 6 8 12 32

Close

4.

Problem Statement

Write a C program to find the factorial of a given integer number using both recursive and non-recursive functions.

Instructions

· Write comment to make your programs readable.

· Use descriptive variables in your programs (Name of the variables shou ld show their purposes).

· Ensure your code compiles without any errors/warning/deprecations

· Avoid too many & unnecessary usage of white spaces (newline, spaces, tabs, …)

· Try to retain the original code given in the exercise, to avoid any issues in compiling & running your programs

· Always test the program thoroughly, before saving/submitting exercises/project

Hints/Tips

#include< —– >

longint fact(int)

void main()

{

variables;

printf(“n enter an integer no:”);

scanf(“%d”,&n);

// non-recursive

for(i=1;i<=n;i++)

{

//logic for factorial calculation

}

printf(“Factorial of %d = %d using non-recursive logic n”, n, variables);

// recursive

printf(“Factorial of %d = %d using recursive logic n”, n, fact(n));

}

longint fact(int n)

{

//logic for factorial calculation

}

Expected Output

Enter the number: 4 Factorial of 4 = 24

5.

Problem Statement

Write a C Program – using pointers To Swap the Values of Two Variables.

Instructions

· Write comment to make your programs readable.

· Use descriptive variables in your programs (Name of the variables shou ld show their purposes).

· Ensure your code compiles without any errors/warning/deprecations

· Avoid too many & unnecessary usage of white spaces (newline, spaces, tabs, …)

· Try to retain the original code given in the exercise, to avoid any issues in compiling & running your programs

· Always test the program thoroughly, before saving/submitting exercises/project

Hints/Tips

# include< —– >

# include < ——- >

main ( )

{

Variables;

printf ( “ Enter values of x and y: n”);

scanf( “ %d%d”, x,y);

*temp = ;

*x= ;

*y= ;

printf();

}

Expected Output

Enter values of x and y: 10 20 x=20 y=10

6.

Problem Statement
Write a C program – using structures for reading the employee details like employee name, date of joining and salary and also to compute Total salary outgo for a month.

Instructions
-Write comment to make your programs readable. -Use descriptive variables in your programs (Name of the variables shou ld show their purposes). – Ensure your code compiles without any errors/warning/deprecations – Avoid too many & unnecessary usage of white spaces (newline, spaces, tabs, …) – Try to retain the original code given in the exercise, to avoid any issues in compiling & running your programs – Always test the program thoroughly, before saving/submitting exercises/project

Hints/Tips
struct personal
{
};
main()
{
variables;
printf (“enter number of employees”); scanf (“%d”,&n);
for (i=1; i<=n; i++)
{
}
printf(“enter the month for total salary”);
scanf(“%s”,month)
for(i=1; i

7. Problem Statement
Write a Program which behaves as prescribed in the below problem statement – Take input/output as specified – Print the expected output using the expected logic/algorithm/data – Code is structured correctly and according to the problem statement

Instructions

· Ensure your code compiles without any errors/warning/deprecations

· Follow best practices while coding

· Avoid too many & unnecessary usage of white spaces (newline, spaces, tabs, …), except to make the code readable

· Use appropriate comments at appropriate places in your exercise, to explain the logic, rational, solutions, so that evaluator can know them

· Try to retain the original code given in the exercise, to avoid any issues in compiling & running your programs

· Always test the program thoroughly, before saving/submitting exercises/project

· For any issues with your exercise, contact your coach

Example

Inputs:

variable1 = input1

variable2 = input2

/* Solution Logic according to asked problem statement */

Expected Output = As described in the problem statement

Warnings

· Take care of whitespace/trailing whitespace

· Trim the output and avoid special characters

· Avoid printing unnecessary values other than expected/asked output

Hints/Tips

int i = 0;

int j = 0 ;

for (int k =0; k < i; k++) {

printf(“this is my hint logic %d”, i);

}

8.

Problem Statement
Write a C Program – to use structure within union, display the structure and length of union elements.

Instructions
· Write comment to make your programs readable.

· Use descriptive variables in your programs (Name of the variables shou ld show their purposes).

· Ensure your code compiles without any errors/warning/deprecations

· Avoid too many & unnecessary usage of white spaces (newline, spaces, tabs, …)

· Try to retain the original code given in the exercise, to avoid any issues in compiling & running your programs

· Always test the program thoroughly, before saving/submitting exercises/project

Hints/Tips
include
Struct hai { }; union bye { }; int main(int argc,char *argv[]) { Struct hai myhai; union bye mybye; …. ….. …..

}

Expected Output
myhai: 1 2 This is myhai mybye: 100 4197476 This is mybye

Applied Sciences
Architecture and Design
Biology
Business & Finance
Chemistry
Computer Science
Geography
Geology
Education
Engineering
English
Environmental science
Spanish
Government
History
Human Resource Management
Information Systems
Law
Literature
Mathematics
Nursing
Physics
Political Science
Psychology
Reading
Science
Social Science
Liberty University
New Hampshire University
Strayer University
University Of Phoenix
Walden University
Home
Homework Answers
Blog
Archive
Tags
Reviews
Contact
twitterfacebook
Copyright © 2022 SweetStudy.comSWEETSTUDY.COM – YOUR HOMEWORK ANSWERS
chat0
Home.Literature.
Help.
Log in / Sign up
C Programming
profile
Shan143

CPractical2.docx
Home>Computer Science homework help>C Programming
1. Problem Statement
Write a C Program – using if else statements, to find the largest number among the given two integer numbers. –

Instructions

· Write comment to make your programs readable.

· Use descriptive variables in your programs (Name of the variables shou ld show their purposes).

· Ensure your code compiles without any errors/warning/deprecations

· Avoid too many & unnecessary usage of white spaces (newline, spaces, tabs, …)

· Try to retain the original code given in the exercise, to avoid any issues in compiling & running your programs

· Always test the program thoroughly, before saving/submitting exercises/project

Hints/Tips

#include<—>

int main()

{

if ( x > y )

{

printf ();

}

else

{

printf ();

}

}

Expected Output

Enter the values for x and y Input: 250 350 Output: Y is large number – 350

Close

2. Problem Statement
Write a C Program to extract a portion of a string from a character string.

Instructions
-Write comment to make your programs readable. -Use descriptive variables in your programs (Name of the variables shou ld show their purposes). – Ensure your code compiles without any errors/warning/deprecations – Avoid too many & unnecessary usage of white spaces (newline, spaces, tabs, …) – Try to retain the original code given in the exercise, to avoid any issues in compiling & running your programs – Always test the program thoroughly, before saving/submitting exercises/project

Hints/Tips
include< ———- >
void main()
{
l=strlen(str1);
if(m+n-1

3.

Problem Statement
a) Write a C program, to find both the largest and smallest number in a list of integers using an Array. b) Write a C program, to add two matrices using an Array. c) Write a C program, to multiply two matrices using an Array.

Instructions
· Write comment to make your programs readable.

· Use descriptive variables in your programs (Name of the variables shou ld show their purposes).

· Ensure your code compiles without any errors/warning/deprecations

· Avoid too many & unnecessary usage of white spaces (newline, spaces, tabs, …)

· Try to retain the original code given in the exercise, to avoid any issues in compiling & running your programs

· Always test the program thoroughly, before saving/submitting exercises/project

Hints/Tips
include void main() { variables; printf(“n =====Matrix Addition=====n”); for(i=0;i<2;i++) { for(j=0;j<2;j++) { //logic } } printf(“n =====Matrix Multiplication=====n”); for(i=0;j<2;j++) { for(j=0;j<2;j++) { for(k=0;k<2;k++) { //logic } } } }

Expected Output
a) Enter the max no of array elements: 4 enter the array elements 43 34 45 54 The maximum number in given array is: 54 The minimum number in given array is: 34 b) Enter elements of matrix A:1 2 3 4 Enter elements of matrix B:1 2 3 4 ===== Matrix Addition ===== 2 4 6 8 c) Enter elements of matrix A: 1 2 3 4 Enter elements of matrix B: 1 2 3 4 ===== Matrix Multiplication ===== 6 8 12 32

Close

4.

Problem Statement

Write a C program to find the factorial of a given integer number using both recursive and non-recursive functions.

Instructions

· Write comment to make your programs readable.

· Use descriptive variables in your programs (Name of the variables shou ld show their purposes).

· Ensure your code compiles without any errors/warning/deprecations

· Avoid too many & unnecessary usage of white spaces (newline, spaces, tabs, …)

· Try to retain the original code given in the exercise, to avoid any issues in compiling & running your programs

· Always test the program thoroughly, before saving/submitting exercises/project

Hints/Tips

#include< —– >

longint fact(int)

void main()

{

variables;

printf(“n enter an integer no:”);

scanf(“%d”,&n);

// non-recursive

for(i=1;i<=n;i++)

{

//logic for factorial calculation

}

printf(“Factorial of %d = %d using non-recursive logic n”, n, variables);

// recursive

printf(“Factorial of %d = %d using recursive logic n”, n, fact(n));

}

longint fact(int n)

{

//logic for factorial calculation

}

Expected Output

Enter the number: 4 Factorial of 4 = 24

5.

Problem Statement

Write a C Program – using pointers To Swap the Values of Two Variables.

Instructions

· Write comment to make your programs readable.

· Use descriptive variables in your programs (Name of the variables shou ld show their purposes).

· Ensure your code compiles without any errors/warning/deprecations

· Avoid too many & unnecessary usage of white spaces (newline, spaces, tabs, …)

· Try to retain the original code given in the exercise, to avoid any issues in compiling & running your programs

· Always test the program thoroughly, before saving/submitting exercises/project

Hints/Tips

# include< —– >

# include < ——- >

main ( )

{

Variables;

printf ( “ Enter values of x and y: n”);

scanf( “ %d%d”, x,y);

*temp = ;

*x= ;

*y= ;

printf();

}

Expected Output

Enter values of x and y: 10 20 x=20 y=10

6.

Problem Statement
Write a C program – using structures for reading the employee details like employee name, date of joining and salary and also to compute Total salary outgo for a month.

Instructions
-Write comment to make your programs readable. -Use descriptive variables in your programs (Name of the variables shou ld show their purposes). – Ensure your code compiles without any errors/warning/deprecations – Avoid too many & unnecessary usage of white spaces (newline, spaces, tabs, …) – Try to retain the original code given in the exercise, to avoid any issues in compiling & running your programs – Always test the program thoroughly, before saving/submitting exercises/project

Hints/Tips
struct personal
{
};
main()
{
variables;
printf (“enter number of employees”); scanf (“%d”,&n);
for (i=1; i<=n; i++)
{
}
printf(“enter the month for total salary”);
scanf(“%s”,month)
for(i=1; i

7. Problem Statement
Write a Program which behaves as prescribed in the below problem statement – Take input/output as specified – Print the expected output using the expected logic/algorithm/data – Code is structured correctly and according to the problem statement

Instructions

· Ensure your code compiles without any errors/warning/deprecations

· Follow best practices while coding

· Avoid too many & unnecessary usage of white spaces (newline, spaces, tabs, …), except to make the code readable

· Use appropriate comments at appropriate places in your exercise, to explain the logic, rational, solutions, so that evaluator can know them

· Try to retain the original code given in the exercise, to avoid any issues in compiling & running your programs

· Always test the program thoroughly, before saving/submitting exercises/project

· For any issues with your exercise, contact your coach

Example

Inputs:

variable1 = input1

variable2 = input2

/* Solution Logic according to asked problem statement */

Expected Output = As described in the problem statement

Warnings

· Take care of whitespace/trailing whitespace

· Trim the output and avoid special characters

· Avoid printing unnecessary values other than expected/asked output

Hints/Tips

int i = 0;

int j = 0 ;

for (int k =0; k < i; k++) {

printf(“this is my hint logic %d”, i);

}

8.

Problem Statement
Write a C Program – to use structure within union, display the structure and length of union elements.

Instructions
· Write comment to make your programs readable.

· Use descriptive variables in your programs (Name of the variables shou ld show their purposes).

· Ensure your code compiles without any errors/warning/deprecations

· Avoid too many & unnecessary usage of white spaces (newline, spaces, tabs, …)

· Try to retain the original code given in the exercise, to avoid any issues in compiling & running your programs

· Always test the program thoroughly, before saving/submitting exercises/project

Hints/Tips
include
Struct hai { }; union bye { }; int main(int argc,char *argv[]) { Struct hai myhai; union bye mybye; …. ….. …..

}

Expected Output
myhai: 1 2 This is myhai mybye: 100 4197476 This is mybye

Applied Sciences
Architecture and Design
Biology
Business & Finance
Chemistry
Computer Science
Geography
Geology
Education
Engineering
English
Environmental science
Spanish
Government
History
Human Resource Management
Information Systems
Law
Literature
Mathematics
Nursing
Physics
Political Science
Psychology
Reading
Science
Social Science
Liberty University
New Hampshire University
Strayer University
University Of Phoenix
Walden University
Home
Homework Answers
Blog
Archive
Tags
Reviews
Contact
twitterfacebook
Copyright © 2022 SweetStudy.com

Order Solution Now