### Two simple programs

Hello everybody.

I need help with two simple programs I was given as homework. I am really (and I mean - REALLY) new to all this programming stuff, so please forgive me for not doing this on my own.

The first program - I have to input data for a matrix B[m][n] where m<8 (rows) and n<10 (columns).
Then I have to input data for interval [c,d] and find which matrix row have the most elements within that interval.

The second program - I need to make a program that inputs data for square matrix A[k][k] where k<7. I need to find the sum and the count of the positive elements standing over the main diagonal.

I am not really into this but I have to do it in order to pass the year. Fortunately I will not have to do it next year. I will really appreciate your help with guidance or source code.

Greetings,
Sasha
We don't do homework, but thanks for asking.
Maybe you should drop the class.
Maybe you shouldn't post if you are not going to help, but thanks anyway.

I'm studying economics and I don't know why the heck they put a computer course in the program. It's the first time I try programming and I have to complete those two problems just after 6 hours of class work.

This is the source I've came up with for the first program (still very, very beta):

 ``12345678910111213141516171819202122232425262728293031323334`` ``````#include main () { int i; // counter int s=0; int c,d; // the interval int A[64]; // array which holds the matrix's elements int m,n; printf ("Beginning of the program." "\n \n"); printf ("Rows: "); scanf ("%d",&m); if (m>7 || m<1) { printf ("\n \n" "This program allows maximum of 7 and minimum of 1 rows.");} return 0;} printf ("\n \n" "Columns: "); scanf ("%d",&n); if (n>9 || n<1) { printf ("\n \n" "This program allows maximum of 9 and minimum of 1 columns.");} return 0;} s=m*n; // s = rows times columns -> equals the total number of elements in the matrix printf ("\n \n" "Input values for matrix's elements: " "\n \n"); for (i=0;i

Unfortunately, I can't think of a way to find which matrix row have the most elements within the interval.

Any ideas?
Last edited on
Topic archived. No new replies allowed.