Advertisement
Guest User

Italian worst "bad" code ever

a guest
Nov 15th, 2012
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.99 KB | None | 0 0
  1.  #include <stdio.h>
  2. #include <motli.h>
  3. #include <stdlib.h>
  4. #include <conio.h>
  5.  
  6. #define PAR "parallelo"
  7. #define SER "serie"
  8.  
  9. void main ()
  10.     {
  11. //definizione delle variabili
  12.     float R1, R2, R3, RTOT;
  13.     char scelta;
  14. //input dati
  15.     printf ("inserisci i valori delle resistenze \n");
  16.     printf ("R1.....");
  17.     scanf ("%f", & R1);
  18.     printf ("\n R2.....");
  19.     scanf ("%f", & R2);
  20.     printf ("\n R3.....");
  21.     scanf ("%f", & R3);
  22. //inserimento del carattere di scelta
  23.     printf ("\n premi s per il collegamento in serie o p per quello in parallelo");
  24.     scanf ("%c", & scelta);
  25.  
  26. //calcolo RTOT
  27. if (scelta == 's');
  28.     RTOT=R1+R2+R3;
  29.     printf ("\n resistenze in % s \n", SER);
  30. elseif (scelta == 'p');
  31.     RTO=1/(1/R1+1/R2+1/R3);
  32.     printf ("\nresistenze in % s \n", PAR);
  33. else
  34.     {
  35.     printf ("\n carattere errato \n");
  36.     printf ("premi un tasto per finire");
  37.     getch ();
  38.     exit (1);
  39.     }
  40.     printf ("\n RTOT = %7.2f \n", RTOT);
  41.     *[
  42.     }//fine main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement