#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
#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(i=0;i<3;i++)
{
for(j=0;j<5;j++)
{
colsum+=array[j][i];
}
printf("Sum of %d coloumn is %0.1f\n",i,colsum);
colsum=0;
}
return(0);
}
// I fixed the code please check
// If any doubt please comment
#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);...
#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.
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 --------------------------------------------");...
I'm having trouble sorting this square matrix (a 2d array that has number of rows and same number of column n x n) using row-wise approach in C programming. Please help me program this in C to sort it using row-wise approach, here is the code: #include <stdio.h> #define MAX 100 int main() { int mat[MAX][MAX]; int i, j, m, n; int rowsum, columnsum, diagonalsum; int k; int magic = 0; int transpose[MAX][MAX]; printf("Enter the # of rows and columns...
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 =...
#include<stdio.h> #include<stdio.h> int main(){ int i; //initialize array char array[10] = {“Smith”, “Owen”, “Kowalczyk”, “Glass”, “Bierling”, “Hanenburg”, “Rhoderick”, “Pearce”, “Raymond”, “Kamphuis”}; for(int i=0; i<8;i++){ for(int j=0; j<9; j++){ if(strcmp(array[j],array[j+1])>0){ char temp[20]; strcpy(temp,array[j]); strcpy(array[j],array[j+1]); strcpy(array[j+1],temp); } } } printf(“---------File Names---------\n”); for(inti=0; i<9; i++){ printf(“\t%s\n”,array[i]); } printf(-------5 Largest Files according to sorting----\n”); for(int i=0;i>=5;i--) { printf(“\t%s\n”,array[i]); } return0; } Consider the "sort" program (using with void* parameters in the bubblesort function) from the week 10 "sort void" lecture. Modify it as follows...
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; }
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,...
#include <stdio.h> int main() { int list[16]; int j, numItems; int temp; scanf("%d",&numItems); for(j=o; j< numItems; j++) scanf("%d",&list[j]); temp=list[0]; for(j=0; j<numItems-1; j++) list[j]=list[j+1]; list[numItems-1]=temp for(j=0; j< numItems-1;j++) printf("%d\t", list[j]); printf("\n"); return 0 } If someone could please turn this c program in pep 9 assembly language. Pep 9 not pep 8 please explain the logic and make sure to use the following four functions getlist() putlist() rotate(); putlist(); each function has two parameters Please do the source code not the...
include<stdio.h> #include<pthread.h> int i=4 ,j=10; void*childfunc(void *p) { printf("child here.i=%d,j=%d\n",i,j); i*=3; j*=3; printf("child here.i=%d,j=%d\n",i,j); } void main() { pthread_t child1; pthread_create(&child, Null,childfunc, Null) pthread_join(child,Null); printf("parent here.i=%d,j=%d\n",i,j); i*=2; j*=2; printf("end of program .i=%d,j=%d\n",i,j); } what is output?
#include <stdio.h> #include <stdlib.h> #include <math.h> int count,i, tracker = 0; int main() { scanf("%d\n", &count); int numbers[count]; //GEtting the numbers and satisfy BS conditions for (i = 0; i < count; i++) { if (scanf("%d", &numbers[i]) != EOF) { tracker++; } if (numbers[i] < 0 || numbers[i] > 99) { printf("%d is not in the [0, 99] range.\n",numbers[i]); exit(i); } } if( tracker != count) { printf("%d numbers are required, but only %d were provided.\n", count, tracker); exit(1); }...