Monday, November 17, 2014

0 syntak bahsa c++

 program syntak bahasa c++

#include <stdio.h>
#include <conio.h>
main()
{
 float x, A, B, C;

  printf(" Nilai A= ");scanf("%f",&A);
  printf(" Nilai B= ");scanf("%f",&B);
  printf(" Nilai C= ");scanf("%f",&C);

  x  = 4*(A + B)/C ;

  printf("hasil = %2f",x);

getch();
}


#include <stdio.h>
#include <conio.h>
main()

{

  int nilai;
  char *hm;

  printf("Input Nilai = ");scanf("%d",&nilai);
  if (nilai>=80)
  {
  hm = "A";
  }
  else
  if (nilai>=70)
  {
  hm = "B";
  }
  else
  if (nilai>=60)
  {
  hm = "C";
  }
  else
  if (nilai>=50)
  {
  hm = "D";
  }
  else
  {
  hm = "E";
  }
  printf("---------------------------\n"); // OUTPUT
  printf("Nilai             = %d\n", nilai);
  printf("Huruf Mutu        = %s\n", hm);
  getch();
  }

0 comments:

Post a Comment