Advertisement
iamakulov

Untitled

Dec 28th, 2013
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.    
  16.         for(i=0;i<n;i++){
  17.             for(j=0;j<m;j++){
  18.                 scanf("%lf", &b[i][j]);
  19.             }
  20.         }
  21.  
  22.         for(i=0;i<n;i++)
  23.         {   flag=1; // Флаг того, что все элементы в столбце отрицательные
  24.             for(j=0;j<m;j++)
  25.             {
  26.                 if(b[i][j]>=0)
  27.                     flag = 0;
  28.             }
  29.             if(flag)
  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