C Answers

Questions answered by Experts: 1 680

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search

PROGRAM TO VERIFY ARMSTRONG NUMBER....FILL THE BLANKS.


#include <stdio.h>

void main() {

int number, temp, remainder, i, power, digits = 0, sum = 0;

printf("Enter a number : ");

scanf("%d", &number);

temp = number;

while (..................) { // complete the condition to iterate the Loop

digits=............; // increment the digits

temp=..............; //calculate the temp value



temp = number;

while (...............) { // complete the condition to iterate the Loop

remainder = number % 10;

i = 1;

power = 1;

while (................) // find the powers of each digit

power=..........................;// calculate power value

i.............; // increment i value

}

sum =..............; // calculate sum value

number=..................; // calculate number value



if (................) {

printf("The given number %d is an armstrong number\n", temp);

}else {

printf("The given number %d is not an armstrong number\n", temp);}

}

}
Create a structure named player where you

have to store the following information of five cricket team players. [Hint : Take input from a text file]

1. Player’s name

2. Player’s country

3. Array(size 2) to store runs of 2 matches

4. Array(size 2) to store wickets of 2 matches

5. Array(size 2) to store points of 2 matches

Count the points using the following formula:

1. Each wicket = 12 points

2. 25 Runs in a match = 5 points

3. 50 Runs in a match = 10 points

4. 75 Runs in a match = 15 points

5. 100 Runs in a match = 20 points


Now Find the Man of the match for the two matches of the series. This is based on the highest point taker in one match. Also find the Man of the series who is the highest point taker in the whole series.
Learners at a local basic school volunteered to sell fresh baked bread to raise funds to increase

the number of computers for their computer lab. Each student reported the number of loaves of

bread he/she sold. Write a C programme that will output the total number of loaves of bread

sold, the total revenue generated by selling the bread, and the average number of loaves of bread

sold by each student. The input data is provided in the following form:
Write a program in C to mimic the “delgroup” command on Linux. This command will delete a group. It has to handle 2 files “passwd” and “shadow”. Both these files will be in some folder specified by an environment variable PFILE. The program has to take all arguments as command line arguments
Write a program in C to mimic the “deluser” command on Linux. This command will delete a user. It has to handle 2 files “passwd” and “shadow”. Both these files will be in some folder specified by an environment variable PFILE. The program has to take all arguments as command line arguments
Rita has newly enrolled into the computer science course in Softech Solutions to learn c Programming , to know about data types she has given a task to solve the following expression with respective data type as ‘a’ and ‘b’ as integer ,’c’ as character , ‘ax’ as long integer, ‘s’ as short integer, ‘dx’ is double and ‘ux’ as unsigned long integer , the expression to get solved is


i)((int) dx) + ax ii) ax + b iii)ax + ux iv) s + c


Help rita to solve the task by writing the c program
A child's parents promised to give the child $10 on her 12th birthday and double the gift on every subsequent birthday until the annual gift exceeded $1000. Write a C program to determine how old the child will be when the last amount is given and the total amount the child will have received.
Write a program in C to mimic the “adduser” command on Linux. This command will add either an ordinary user or a system user. It has to handle 2 files “passwd” and “shadow”. Both these files will be in some folder specified by an environment variable PFILE. The program has to take all arguments as command line arguments
Note answer in C language only

Create a struct called Invoice that a hardware store might use to represent an invoice

for an item sold at the store. An Invoice should include four data members—a part

number (type string), a part description (type string), a quantity of the item being

purchased (type int) and a price per item (type float). Your program should initialize the

four data members. In addition, it should calculate the invoice amount (i.e., multiplies the

quantity by the price per item), If the quantity is not positive, it should be set to 0. If the

price per item is not positive, it should be set to 0. Write a test program that demonstrates

struct Invoice’s capabilities.

Note: Perform this work using

1. pointer to 2d arrays and design function for calculating the results by passing array to function by value and by

reference.
Perform this in C language

Q1. Create a struct called Invoice that a hardware store might use to represent an invoice for an item sold at the store. An Invoice should include four data members—a part number (type string), a part description (type string), a quantity of the item being purchased (type int) and a price per item (type float). Your program should initialize the four data members. In addition, it should calculate the invoice amount (i.e., multiplies the quantity by the price per item), If the quantity is not positive, it should be set to 0. If the price per item is not positive, it should be set to 0. Write a test program that demonstrates struct Invoice’s capabilities. Note: Perform this work using 1. 2d array 2. pointer to 2d arrays 3. design function for calculating the results by passing array to function by value and by reference.

Expert's answer
LATEST TUTORIALS
APPROVED BY CLIENTS