Advertisement
Guest User

Untitled

a guest
Dec 28th, 2013
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.75 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<conio.h>
  3. #include<Windows.h>
  4.  
  5. int main ()
  6. {
  7.     double b[20][20]; int i,n,j,m,col,x=0;
  8.     SetConsoleOutputCP(1251);
  9.     SetConsoleCP(1251);
  10.  
  11.     printf("Введите количество столбцов и строк\n");
  12.     scanf("%d %d", &n,&m);
  13.     if(0<n<20&&0<m<20){
  14.    
  15.         for(i=0;i<n;i++){
  16.         for(j=0;j<m;j++){
  17.             scanf("%lf", &b[i][j]);}}
  18.  
  19.         for(i=0;i<n;i++)
  20.         {   col=0;
  21.             for(j=0;j<m-1;j++)
  22.             {
  23.                 if(b[i][j]!=0)
  24.                 {
  25.                     if(b[i][j]<b[i][j+1]<0)
  26.                         col++;
  27.                 }
  28.             }
  29.             if(col==m-1)
  30.                 x++;
  31.  
  32.  
  33.        }
  34.         printf("\nКоличество столбцов отрицательного - %d\n", x);
  35.         getch ();
  36.         exit (0);
  37.     }
  38.     else
  39.         printf("Массива не существует");
  40.     getch ();
  41.     return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement