Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<conio.h>
- #include<Windows.h>
- int main ()
- {
- double b[20][20]; int i,n,j,m,col,x=0;
- SetConsoleOutputCP(1251);
- SetConsoleCP(1251);
- printf("Введите количество столбцов и строк\n");
- scanf("%d %d", &n,&m);
- if(0<n<20&&0<m<20)
- {
- for(i=0;i<n;i++){
- for(j=0;j<m;j++){
- scanf("%lf", &b[i][j]);
- }
- }
- for(i=0;i<n;i++)
- { flag=1; // Флаг того, что все элементы в столбце отрицательные
- for(j=0;j<m;j++)
- {
- if(b[i][j]>=0)
- flag = 0;
- }
- if(flag)
- x++;
- }
- printf("\nКоличество столбцов отрицательного - %d\n", x);
- getch ();
- exit (0);
- }
- else
- printf("Массива не существует");
- getch ();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement