daily pastebin goal
1%
SHARE
TWEET

Untitled

a guest May 17th, 2018 120 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #define meret 5
  4. int absolut(int a)
  5. {
  6.     return (a>=0) ? a : a*(-1);
  7. }
  8.  
  9.  
  10. int main()
  11. {
  12.     printf("Hello world!\n");
  13.     int tomb[meret];
  14.     double osszeg, atlag, osszegpoz;
  15.     int i,k,paros;
  16.     k=0;
  17.     paros=k;
  18.     for (i=0;i<meret;i++)
  19.     {
  20.         printf("A tomb %d-edik eleme: \t",i);
  21.         scanf("%d",&tomb[i]);
  22.         osszeg+=tomb[i];
  23.         if (tomb[i]>0)
  24.         {osszegpoz+=tomb[i];
  25.         k++;}
  26.         if (tomb[i]%2==0)
  27.         {paros++;}
  28.     }
  29.     atlag=osszegpoz/k;
  30.     printf("pozitivak atlaga: %lf, pozitivak osszege: %lf, paros szamok: %d\n",atlag,osszegpoz,paros);
  31.     return 0;
  32.  
  33.     int n=1000;
  34.     int tom[n];
  35.     int ch; i=0;
  36.  
  37.     while ((ch=getchar())!=10)
  38.     {
  39.         scanf("%d",&ch);
  40.         tom[i]=ch;
  41.         i++;
  42.     }
  43. printf("Beolvasott karakterek");
  44. printf(" szama: %d\n",sizeof(tomb)/sizeof(tomb[0]));
  45. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top