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 --------------------------------------------");
return 0;
}
Do you have a flowgorithim flow chart for this code? #include <stdio.h> int main() { int num,i=0,sum=0; float aver...
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...
#include <stdio.h> #include<string.h> int main() { char strText[100] ="Start"; char i; int nTextASCIISum = strText[0] + strText[1] + strText[2]; int nTextLen = strlen(strText); int count = 0; printf("Welcome to token generator!\n"); printf("Enter a word to use in the token generator.\n You may enter as many words as you like. \n Press q and key when finished.\n"); scanf("%c", &strText[i]); //compute when to stop loop //check nTextLen == 1 and strText[0] == 'q' for(i=0;i< nTextLen;i++) if ((strlen(strText) != 1) || (strText[0] !=...
PUT INTO PYTHON CODE #include <stdio.h> #include <float.h> int main(void) { float a = 1; float b = 0.5; float c = a + b; int bits = 0; while (c != a) { bits = bits + 1; b = b / 2; c = a + b; } printf("%d\n",bits); return 0; }
#include "stdio.h" int main() { float array[5][3],rowsum=0.0,colsum=0.0; int i,j; for(i=0;i<5;i++){ printf("Enter the %d elements of array:\n",i); for(j=0;j<3;j++){ scanf("%f",&array[i][j]); } } printf("Given table data:\n"); for(i=0;i<5;i++){ for(j=0;j<3;j++){ printf(" %0.1f",array[i][j]); } printf("\n"); } for(i=0;i<5;i++){ for(j=0;j<3;j++){ rowsum=rowsum+array[i][j]; } printf("sum of the %d row is %0.1f\n",i,rowsum); rowsum=0; } for(j=0;j<3;j++){ colsum+=array[j][i]; printf("Sum of %d coloumn is %0.1f\n",j,colsum); colsum=0; } return(0); } can someone help me to get the correct row sum and column sum in c program
C program. Using do-while loop for this question. Question: write a program to calculate the average of first n numbers. output: Enter the value of n : 18 The sum of first 18 numbers =171 The average of first 18 numbers = 9.00 my code couldn't give me the right avg and sum. Please help. #include<stdio.h> int main() { int num; int count =0; int sum=0; float avg; printf("Enter the value of n: "); ...
Can you write the algorithm for this code? #include<stdio.h> int main() { int process[20], priority[20], arrival_time[20], burst_time[20], turnaround_time[20], waiting_time[20]; int i, j, limit, sum = 0, position, temp; float average_wait_time, average_turnaround_time; printf("Enter Total Number of Processes:\t"); scanf("%d", &limit); printf("\nEnter Burst Time and Priority For %d Processes\n", limit); for(i = 0; i < limit; i++) { printf("\nProcess[%d]\n", i + 1); printf("Process Burst Time:\t"); scanf("%d", &burst_time[i]); printf("Process Priority:\t"); scanf("%d", &priority[i]); process[i] = i + 1; } for(i = 0; i < limit;...
#include<stdio.h> int main() { int data[10], i, j, temp; printf("Enter 10 random number to sort in ascending order:\n"); for(i = 0; i < 10; i++) scanf("%d", &data[i]); /* Sorting process start */ ****** INSERT YOUR CODE TO COMPLETE THE PROGRAM ****** printf("After sort\n"); for(i = 0; i < 10; i++) printf("%d\n",data[i]); return 0; } Looking for alternative solutions for the program code.
How do i finish this code: #include <stdio.h> int main() { long long decimal, tempDecimal, binary; int reminder, weight = 1; binary = 0.0; //Input decimal number from user printf("Enter any decimal number: "); scanf("%lld", &decimal); // Since we do not want change the value of decimal in the code // let us use tempDecimal to store the value of decimal tempDecimal = decimal; printf("\n\n"); // Let us use while loop first to implement printf("while loop part:\n"); /**************START FROM HERE...
Explain the code and analyze the performance of algorithm #include<stdio.h> #include<string.h> #define NUM 100 #define maxint 10000 void dijkstra(int n,int v,int dist[],int prev[],int c[][NUM]) { int i,j; bool s[NUM]; for(i=1; i<=n; i++) { dist[i] = c[v][i]; s[i] = false; if (dist[i]>maxint) prev[i] = 0; else prev[i] = v; } dist[v] = 0; s[v] = true; for(i=1; i<n; i++) { int tmp = maxint; int u = v; for(j=1; j<=n; j++) if(!(s[j]) && (dist[j]<tmp)) { u = j; tmp = dist[j]; ...