Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 2nd, 2012  |  syntax: C  |  size: 0.40 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4.  
  5. int main(void) {
  6.         int a,b,r,i,h,d=0;
  7.        
  8.         printf("Podaj poczatek przedzialu:\n");
  9.         scanf("%d",&a);
  10.         printf("Podaj koniec przedzialu:\n");
  11.         scanf("%d",&b);
  12.         printf("Podaj promien:\n");
  13.         scanf("%d",&r);
  14.        
  15.         for(i=a;i<b;i++)
  16.         {      
  17.                 for(h=a;h<b;h++)
  18.                 {      
  19.                 if(sqrt(i*i+h*h)<r)
  20.                 d++;
  21.                 }
  22.                
  23.         }
  24.         printf("Liczba par: %d\n",d);
  25.         system("pause");
  26.        
  27. }