Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1.write a program to read 3 numbers from keyboard. Use if statements to display

ID: 3579726 • Letter: 1

Question

1.write a program to read 3 numbers from keyboard. Use if statements to display the smallest and the largest values of these 3 numbers.
2.write a loop that displays odd numbers from 3 to 101.
3.write a function accept 3 integer value parameters pass by value technique the function should find the average of these 3 values and returns a double value representing the average. Write the main program ad well that reads three numbers from the keyboard and send it to function average. Main should display the average value
4.write a program to create an array of size 100. Write 100 random numbers in this array and display the values of this array
5. Write a function called max that accepts the array and find the maximum value of this array. The function should return this maximum value
6.write a structure called student that has 2 members variable id and score both integer. In main program created 2 structures variable called s1 and s2. The id for student s1 is 1 and id for student s2 is 2.write the id values for each student in the id field. Write random value in the range 10 to 100 for the score for each student
7.write a program to create a text file called numbers in write mode and write 10 random integer numbers in this file. Close the file
8.open the text file numbers in read mode and read each of the 10 integer and displays each number on the monitor
9.create one variable of type integer. Read a number from the keyboard into this variable. Declare an integer pointer and place the address of this variable in that pointer. Pass this pointer to a void function called cube. The function should find the cube of this value. The program after calling the function should display the cube.
Write in c program
Please don't combine the answers. 1.write a program to read 3 numbers from keyboard. Use if statements to display the smallest and the largest values of these 3 numbers.
2.write a loop that displays odd numbers from 3 to 101.
3.write a function accept 3 integer value parameters pass by value technique the function should find the average of these 3 values and returns a double value representing the average. Write the main program ad well that reads three numbers from the keyboard and send it to function average. Main should display the average value
4.write a program to create an array of size 100. Write 100 random numbers in this array and display the values of this array
5. Write a function called max that accepts the array and find the maximum value of this array. The function should return this maximum value
6.write a structure called student that has 2 members variable id and score both integer. In main program created 2 structures variable called s1 and s2. The id for student s1 is 1 and id for student s2 is 2.write the id values for each student in the id field. Write random value in the range 10 to 100 for the score for each student
7.write a program to create a text file called numbers in write mode and write 10 random integer numbers in this file. Close the file
8.open the text file numbers in read mode and read each of the 10 integer and displays each number on the monitor
9.create one variable of type integer. Read a number from the keyboard into this variable. Declare an integer pointer and place the address of this variable in that pointer. Pass this pointer to a void function called cube. The function should find the cube of this value. The program after calling the function should display the cube.
Write in c program
Please don't combine the answers.
2.write a loop that displays odd numbers from 3 to 101.
3.write a function accept 3 integer value parameters pass by value technique the function should find the average of these 3 values and returns a double value representing the average. Write the main program ad well that reads three numbers from the keyboard and send it to function average. Main should display the average value
4.write a program to create an array of size 100. Write 100 random numbers in this array and display the values of this array
5. Write a function called max that accepts the array and find the maximum value of this array. The function should return this maximum value
6.write a structure called student that has 2 members variable id and score both integer. In main program created 2 structures variable called s1 and s2. The id for student s1 is 1 and id for student s2 is 2.write the id values for each student in the id field. Write random value in the range 10 to 100 for the score for each student
2.write a loop that displays odd numbers from 3 to 101.
3.write a function accept 3 integer value parameters pass by value technique the function should find the average of these 3 values and returns a double value representing the average. Write the main program ad well that reads three numbers from the keyboard and send it to function average. Main should display the average value
4.write a program to create an array of size 100. Write 100 random numbers in this array and display the values of this array
5. Write a function called max that accepts the array and find the maximum value of this array. The function should return this maximum value
6.write a structure called student that has 2 members variable id and score both integer. In main program created 2 structures variable called s1 and s2. The id for student s1 is 1 and id for student s2 is 2.write the id values for each student in the id field. Write random value in the range 10 to 100 for the score for each student
7.write a program to create a text file called numbers in write mode and write 10 random integer numbers in this file. Close the file
8.open the text file numbers in read mode and read each of the 10 integer and displays each number on the monitor
9.create one variable of type integer. Read a number from the keyboard into this variable. Declare an integer pointer and place the address of this variable in that pointer. Pass this pointer to a void function called cube. The function should find the cube of this value. The program after calling the function should display the cube.
Write in c program
Please don't combine the answers.

Explanation / Answer

#include <stdio.h>   
#include <stdlib.h>
double avgof3(int a,int b,int c);
int max(int[]);


int main(void)
{   
   time_t t;
int a,b,c,i;
double avg;
int randarray[100];
int maxvalue;
  
printf("///////////////////// Begin Part 1////////////////////////// ");
printf("Enter 3 integers ");
scanf("%d%d%d",&a,&b,&c);
if(a<b && a<c)
printf("%d is smallest ",a);
else if(b<a && b<c)
printf("%d is smallest ",b);
else
printf("%d is smallest ",c);
  
  
if(a>b && a>c)
printf("%d is largest ",a);
else if(b>a && b>c)
printf("%d is largest ",b);
else
printf("%d is largest ",c);
printf("///////////////////// End Part 1////////////////////////// ");
  
  
  
printf("///////////////////// Begin Part 2 -Display odd numbers////////////////////////// ");
for(i=3;i<=101;i=i+2)
printf("%d ",i);
  
printf("///////////////////// End Part 2////////////////////////// ");
  

printf(" ///////////////////// Begin Part 3 -Average of three numbers////////////////////////// ");
printf(" Enter 3 integers for average ");
scanf("%d%d%d",&a,&b,&c);
avg=avgof3(a,b,c);
printf("Average of %d,%d,%d is %lf",a,b,c,avg);

printf("///////////////////// EndPart 3 -Average of three numbers////////////////////////// ");

   printf(" ///////////////////// Begin Part 4 ////////////////////////// ");
/* Intializes random number generator */
srand((unsigned) time(&t));
for(i=0;i<100;i++)
{
    randarray[i]=rand() % 50;
    //printf("%d ", randarray[i]);
   
}
printf(" /////////////////////EndPart 4 ////////////////////////// ");
  
   printf(" ///////////////////// Begin Part 5 ////////////////////////// ");
   maxvalue=max(randarray);
   printf("Max of array %d",maxvalue);
  
   printf(" ///////////////////// End Part 5 ////////////////////////// ");   

return 0;
  
}

double avgof3(int a,int b,int c)
{
   return (a+b+c)/3;
}
int max(int z[])
{
   int max=0,x;
   for (x=0;x<100;x++)
   {
       if(z[x]>max)
       max=z[x];
   }
   return max;
}

Output :

///////////////////// Begin Part 1//////////////////////////
Enter 3 integers
10
20
30
10 is smallest
30 is largest
///////////////////// End Part 1//////////////////////////
///////////////////// Begin Part 2 -Display odd numbers//////////////////////////
3 5 7 9 11 13 15 17 19 21
23 25 27 29 31 33 35 37 39 41
43 45 47 49 51 53 55 57 59 61
63 65 67 69 71 73 75 77 79 81
83 85 87 89 91 93 95 97 99 101
///////////////////// End Part 2//////////////////////////

///////////////////// Begin Part 3 -Average of three numbers//////////////////////////

Enter 3 integers for average
1
2
3
Average of 1,2,3 is 2.000000///////////////////// EndPart 3 -Average of three numbers//////////////////////////

///////////////////// Begin Part 4 //////////////////////////

/////////////////////EndPart 4 -//////////////////////////

///////////////////// Begin Part 5 //////////////////////////
Max of array 49
///////////////////// End Part 5 //////////////////////////

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote