Anyone please help me to find the problem

0 votes
asked Sep 3, 2018 by Shoffiulla
#include<stdio.h>

float gettgp (int mark, int credit)

{

  float tgpa;

  if (mark >= 80 && mark <= 100)

    {

      tgpa = (4.00 * credit);

    }

  else if (mark >= 75 && mark <= 79)

    {

      tgpa = (3.75 * credit);

    }

  else if (mark >= 70 && mark <= 74)

    {

      tgpa = (3.50 * credit);

    }

  else if (mark >= 65 && mark <= 69)

    {

      tgpa = (3.25 * credit);

    }

  else if (mark >= 60 && mark <= 64)

    {

      tgpa = (3.00 * credit);

    }

  else if (mark >= 55 && mark <= 59)

    {

      tgpa = (2.75 * credit);

    }

  else if (mark >= 50 && mark <= 54)

    {

      tgpa = (2.50 * credit);

    }

  else if (mark >= 45 && mark <= 49)

    {

      tgpa = (2.25 * credit);

    }

  else if (mark >= 40 && mark <= 44)

    {

      tgpa = (2.00 * credit);

    }

  else

    {

      tgpa = 0;

    }

  return tgpa;

}

int

main ()

{

  int n, y, i, j, l, x, c, g;

  float m, spoint;

  printf ("Total Semesters : ");

  scanf ("%d", &n);

  for (i = 1; i <= n; i++)

    {

      printf ("\n=====Semester %d======", i);

      printf ("\nTotal Subject : ");

      scanf ("%d", &x);

      for (j = 1; j <= x; j++)

{

  printf ("Subject %d credit : ", j);

  scanf ("%d", &c);

  printf ("Subject %d mark :", j);

  scanf ("%d", &m);

  spoint = gettgp (m, c);

  printf ("point %.2f\n", spoint);

}

    }

  return 0;

}

why print point = 0.00 ???

1 Answer

0 votes
answered Sep 3, 2018 by anonymous
replace && operator with || operator
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...