Professional Documents
Culture Documents
07 - Osnovi Programiranja
07 - Osnovi Programiranja
OSNOVI PROGRAMIRANJA
VEŽBE 7
M a x ( x ,y ) #include <stdio.h>
int Max(int x, int y)
ne {
x > y
int max;
da if (x>y) max=x;
M ax = x M ax = y else max=y;
return max;
}
p o v r a ta k
main()
{
p o c e ta k int a,b,c,m;
a ,b ,c scanf("%d%d%d",&a,&b,&c);
m=Max(a,b);
m = M a x ( a ,b ) m=Max(m,c);
m = M a x (m ,c ) printf("%d\n",m);
m }
k ra j
#include <stdio.h>
F a k t(n ) long Fakt(int n)
{
f = 1
long f; int i;
i = 1 ,n
f=1;
}
k ra j
b = 0
#include <stdio.h>
int BrojDel(int n)
i = 1 ,n {
int i, b;
n m od i = 0 b=0;
da
b = b + 1 for(i=1; i<=n; i++)
if(n%i == 0) b++;
B r o jD e l = b return b;
}
p o v r a ta k main()
{
int n;
p o c e ta k
scanf("%d",&n);
n if(BrojDel(n)<=2) printf("Broj je prost\n");
else printf("Broj je slozen\n");
ne
B r o jD e l( n ) < = 2
da }
P ro s t S lo z e n
k ra j
d m a x a b , a c m in a c , b
#include <stdio.h>
void Zbir_Kvad(int n)
{
int i; long zbir=0;