#include <stdlib.h>
#include <stdio.h>


int main(int argc, char **argv)
{
  float a,b;
  int res;


  do
  {
    printf("Zadejte stranu a obdelnika: ");
    res = scanf("%f",&a);
    if (res==0 || a < 0) printf("Spatne zadana strana!\n");
    while(getchar()!='\n');
  }
  while(res==0 || a < 0);

  do
  {
    printf("Zadejte stranu b obdelnika: ");
    res = scanf("%f",&b);
    if (res==0 || b < 0) printf("Spatne zadana strana!\n");
    while(getchar()!='\n');
  }
  while(res==0 || b < 0);

  printf("Obsah obdelnika je %.3f, obvod je %.3f\n",a*b,2*(a+b));
  system("PAUSE");
  return 0;
}

