[solved] – Question 84012
receive 3 numbers and display them ascending order from the smallest to largest
Expert Answer
[solved] – Question 84049
• Create or find 3 files containing C programs such as the one given below
#include <stdio.h>
struct time {
int hour,min;
};
typedef struct {
int flightno;
struct time arrival;
}FlightInfo;
void inp(FlightInfo arr[]){
int i;
for (i=0;i<2;i++)
{
printf(“Enter flight no and arrival time:”);
scanf(“%d %d %d”,&arr[i].flightno,&arr[i].arrival.hour,&arr[i].arrival.min);}}
void calculateDelay(FlightInfo arr[], int d){
int i,x;
for (i=0;i<2;i++) {
• For the three C programs,
◦ Read the file name from the user and open the file
◦ Read the C program from the text file and find the
▪ number of statements in the program
▪ number of for, while and do-while loops in the program
Output
Sample Run:
Program named “flights.cpp” contains:
53 lines of code
3 for loops
2 while loops
1 do-while loop
Program named “hw.cpp” contains:
45 lines of code
1 for loop
3 while loops
0 do-while loop
Expert Answer
[solved] – Question 84104
Write the equivalent C++ expression for the following algebraic
expressions involving variables P, Q and R : 3
1. P 5Q
Expert Answer
[solved] – Question 84140
the user prints number of string and each string’s length then the program prints every prefix that starts with the first letter (for example the string (abab) the prefixes are: a ab aba abab)
if we have more than a string and they have a common prefix it’s printed only one time (for example the strings aaba and aabb -the prefixes are a aa aab aaba aabb
Example:
Please enter the size of the strings set:
input:2
Please enter the strings set (n, string):
input:2 aa
input:3 aba
The prefixes of the strings set are:
a
aa
ab
aba
Expert Answer
[solved] – Question 84141
the user prints number of string and each string’s length then the program prints every prefix that starts with the first letter (for example the string (abab) the prefixes are: a ab aba abab)
if we have more than a string and they have a common prefix it’s printed only one time (for example the strings aaba and aabb -the prefixes are a aa aab aaba aabb
Example:
Please enter the size of the strings set:
input:2
Please enter the strings set (n, string):
input:2 aa
input:3 aba
The prefixes of the strings set are:
a
aa
ab
aba
Expert Answer
[solved] – Question 84142
Write a program that accepts a positive number from the user and displays the factorial of that number. using recursion
Expert Answer
[solved] – Question 84143
Write a program which reads 10 integers from the keyboard in the range 0 – 100, and counts how many of them are larger than 50, and displays this result. Using recursion.
Expert Answer
[solved] – Question 84145
Write a program that accepts marks of five students and then displays their average. The program should not accept mark which is less than 0 and mark greater than 100. using recursion
Expert Answer
[solved] – Question 84201
I want to write a program that finds prime numbers using a sieve of Eratosthenes method.
I must use (variable length array) vom Typ bool.
I wrote the following code, but unfortunately it does not work.
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
int main()
{ int n,i;
printf(“Enter the limit: “);
scanf(“%d”,&n);
int size = sizeof(A)/ sizeof(n);
prim(A,size);
for(i=2;i<n;i++)
{
if(A[i])
{
printf(“n%d”,i);
}
}
return 0;
}
bool prim(int* A, int size)
{
int i,j;
for(i=2;i<n;i++)
A[i] = true;
for(i=2;i<n;i++)
{
for(j=i;i*j<n;j++)
{
A[i*j] = false;
}
}
}
can you help me please?
Expert Answer

