Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <conio.h>
- #include <stdlib.h>
- float R (int N,int M, float **matris, float *num2);
- int main(void) {
- int i,j,c,N,M,count;
- float **matris,num2;
- printf("Define array size(NxM): ");
- scanf("%d %d", &N,&M);
- matris=(float **)malloc(N*sizeof(int));
- for(i=0;i<M;i++){
- matris[i]=(float *)malloc(N*sizeof(int));
- }
- //read(N,M);
- R (N,M,matris,&num2);
- printf("Number 1. Number of negative values = %d",count);
- for(c=0;c<count;c++){
- printf("Negative values = %f",&num2[c]);
- }
- return 0;
- }
- float R (int N,int M, float **matris, float *num2)
- {
- int i,j,k,l,count;
- for(i=0;i<N;i++)
- {
- for(j=0;j<M;j++)
- {
- printf("Please enter value of array[%d][%d] :",i,j);
- scanf("%d",&matris[i][j]);
- }
- }
- for (k=0; k<N; k++)
- {
- for(l=0;l<M;l++)
- {
- if(matris[k][l]<0)
- {
- *num2[count]=matris[k][l];
- count++;
- }
- }
- }
- if (count==0){
- printf("There is no negative numbers in this array. Number 0");
- return 0;
- }
- return count;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement