Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // minimapelinie.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- int _tmain(int argc, _TCHAR* argv[])
- {
- int a[10][10],m,n,min,i,j,k,v[100],minl,h=0;
- printf("Numar linii:");
- scanf("%d",&m);
- printf("Numar coloane:");
- scanf("%d",&n);
- for(i=0;i<=m-1;i++)
- for(j=0;j<=n-1;j++)
- { printf("a[%d][%d]=",i,j);
- scanf("%d",&a[i][j]);
- }
- printf("Matricea este: \n");
- for(i=0;i<=m-1;i++)
- {for(j=0;j<=n-1;j++)
- printf("%d ",a[i][j]);
- printf("\n");}
- for(i=0;i<=m-1;i++)
- {minl=9999;
- for(j=0;j<=n-1;j++)
- if(a[i][j]<minl) v[++h]=a[i][j]
- scanf("%d",&k);
- }
- // ma_pozitive_negative.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- int _tmain(int argc, _TCHAR* argv[])
- {
- int i,v[100],n,cn,cp,sp,sn,k;
- float mp,mn;
- cn=0;
- cp=0;
- sn=0;
- sp=0;
- printf("Numar de elemente din vector:");
- scanf("%d",&n);
- for(i=0;i<n;i++)
- {printf("Introduceti numar:");
- scanf("%f",&v[i]);}
- for(i=0;i<=n-1;i++)
- if(v[i]<0) {cn=cn+1;
- sn=sn+l;}
- else {cp=cp+1;
- sp=sp+v[i];}
- mp=sp/cp;
- printf("%f %d %d",mp,sp,cp);
- /*
- mn=sn/cn;
- printf("%f",mn);
- /*
- if(cp==0) printf("Nu exista numere pozitive!\n");
- else {mp=(float)sp/cp;
- printf("%f",mp);
- printf("\n");
- }
- if(cn==0) printf("Nu exista numere negative!\n");
- else {mn=(float)sn/cn;
- printf("%f",mn);
- printf("\n");
- }*/
- scanf("%d",&k);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement