//C programing help
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#define SIZE 5
int main() {
double gradesWithBonus[SIZE];
int i;
for (i = 0; i < SIZE; i++) {
printf("Please enter your grade:
"); //getting grade
scanf("%lf",
&gradesWithBonus[i]);
printf("\n");
}
for (i = 0; i < SIZE; i++) { //adding 5 to entered
grade
double bonous;
bonous = gradesWithBonus[i] +
5.0;
printf("Grade entered at array
element %d is: %.2lf\n\n", i, gradesWithBonus[i]);
printf("With the bonous added, your
new grade is %.2lf\n\n", bonous);
}
for (i = 0; i < SIZE; i++) {
//Loop that calculates the total
of the new grade. NEED HELP HERE
double total;
total = ;
}
//Have to divide the sum by SIZE and print the average onto the screen. NEED HELP HERE
return 0;
}
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #define SIZE 5 int main() { double gradesWithBonus[SIZE]; int i; for (i = 0; i < SIZE; i++) { printf("Please enter your grade: "); //getting grade scanf("%lf", &gradesWithBonus[i]); printf("\n"); } for (i = 0; i < SIZE; i++) { //adding 5 to entered grade double bonous; bonous = gradesWithBonus[i] + 5.0; printf("Grade entered at array element %d is: %.2lf\n\n", i, gradesWithBonus[i]); printf("With the bonous added, your new grade is %.2lf\n\n", bonous); } double total = 0; for (i = 0; i < SIZE; i++) { total = gradesWithBonus[i]; } printf("Average is %lf\n", total/SIZE); return 0; }
//C programing help #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #define SIZE 5 int main() { double gradesWithBonus[SIZE];...
i need flowchart for the following c code #include <stdio.h> int main() { int n, i, sum = 0; printf("Enter an integer: "); scanf("%d",&n); i = 1; while ( i <=n ) { sum += i; ++i; } printf("Sum = %d",sum); return 0; }
Solve using C programming 3. lf you are given this code. #include <stdio.h> int main() int var1, var2; int sum; printf("Enter number 1:\n "); scanf("%d",&var1); printf("Enter number 2:In ); scanf("%d",&var2); sum-var1+var2; printf ("Vnsum of two entered numbers : %d", //printf ("Output: %d", res); sum); return e; Modify this code by creating a function called "addition". Make the arguments of the functions numberl and number 2. Add the two values in the function. Return a value called "result". Print "result" in...
C code program help. I am trying to find the total parallel resistive load. This is what I have so far. It does run, it does ask for numbers. But it doesn't calculate. It just comes out "The parallel is: 0.00". I have tried 3, 4, 5 and 3.2, 4.3, 5.4. Still only shows 0.00. I have tried several combinations of putting different data types in both main.c and the rest of it. Any help or ideas would be helpful....
sort.c #include <stdlib.h> #include <stdio.h> #include "libsort.h" int main() { int* array; int size, c; float median; printf("Enter the array size:\n"); scanf("%d", &size); array = (int*) malloc(size * sizeof(int)); printf("Enter %d integers:\n", size); for (c = 0; c < size; c++) scanf("%d", &array[c]); sort(array, size); printf("Array sorted in ascending order:\n"); for (c = 0; c < size; c++) printf("%d ", array[c]); printf("\n"); median = find_median(array,...
Convert this code from C to C++ include <stdio.h> include <locale.h> void filtre (double x. double yll, double yol, int , int N) int Nn-10000 int main) setlocale (LC ALL,") double x(Nm) , y [ Nm],yo Nml®(0.0); int m; FILE dosyal-fopen("D:/veri/673.txtr FILE dosya2-fopen("D:/veri/data2.txt int i-0 while( feof (dosyal)) fscanf (dosyal, " ",xi sytil) fclose (dosyal) int Nij printf("Pencere Genişligi scanf() 3 filtre(x,y.Yo,m,N) for(int k-0keNkt+)fprintf (dosya2, 10.41 10.411 0.41fn",x[k],y[k].yo[k]) fclose(dosya2) void filtre (double x double y. double yoll, int m, int...
C program-- the output is not right please help me to correct it. #include <stdio.h> int main() { int arr[100]; int i,j,n,p,value,temp; printf("Enter the number of elements in the array: \n "); scanf("%d",&n); printf("Enter %d elements in the array: \n",n); for(i=0;i<n;i++) { printf("\nelement %d: ",i); scanf("\n%d",&arr[i]); } printf("\nEnter the value to be inserted: \n "); scanf("\n%d",&value); printf("The exist array is: \n"); for(i=0;i<n;i++) { printf("%d",arr[i]); } p=i; for(i=0;i<n;i++) if(value<arr[i] ) { p = i; break; } arr[p]=value; printf("\n"); for (i =...
I am told to find the median of random inputs using if statements in C #include <stdio.h> #include <stdlib.h> int main() { double a, b, c, d; scanf("%lf", &a); scanf("%lf", &b); scanf("%lf", &c); if (a<b && b<c) d = b; printf("%.0f\n", d); else if (b<a && a<c) d = a; printf("%.0f\n", d); else d = c; printf("%.0f\n", d); return 0; } That is my code, I keep getting an error for the else if and else saying there is no...
Translate the following C program to Pep/9 assembly language. #include <stdio.h> int main() { int number; scanf("%d", &number); if (number % 2 == 0) { printf("Even\n"); } else { printf("Odd\n"); } return 0; }
Do you have a flowgorithim flow chart for this code? #include <stdio.h> int main() { int num,i=0,sum=0; float average; int customerNumbers[num]; int customerSales[num]; printf("How many customers do you want to track?\n"); scanf("%d",&num); while(i<num) { printf("Enter the customer number. "); scanf("%d",&customerNumbers[i]); printf("Enter the sales for the customer "); scanf("%d",&customerSales[i]); i++; } printf("Sales for the Customer"); printf("\nCustomer Customer"); printf("\nNumber Sales"); for(i=0;i<num;i++) { printf("\n %d \t %d",customerNumbers[i], customerSales[i]); sum=sum+customerSales[i]; } average=(int)sum/num; printf("\n Total sales are $%d",sum); printf("\n Average sales are $%.2f",average); printf("\n --------------------------------------------");...
C++ Can someone please help with this code... even when the players number isnt a winning number the program always says the player wins: #include <stdio.h> #include <time.h> //main function int main() { //seeding a random number srand(time(0)); //define the arrays for the wagered, winning amount, percent amount double amounts[7] = { 1, 5, 10, 20, 50, 100, 1000 }; double payoff[7] = { 100, 500, 1000, 2000, 5000, 10000, 100000 }; double percent[7] = { 0.01, 0.05, 1, 2,...