Get up to 80 % extra points for free! More info:

Discussion: C Program Error in Development of Love Clculator

In the previous quiz, C++ online test, we tested our experience gained from the course.

Activities
Avatar
Gaurav Negi
Member
Avatar
Gaurav Negi:6/13/2023 11:35

Hello this is Gulshan Negi
Well, I am writing a program for making love calculator but it shows some error, I don't know whar I am missing here.
Here is my source code:

#include<ctype.h>
#include<stdio.h>
#include <conio.h>
#include<string.h>

int Sum_of_Digits(int digit)
    {
       int sum =0;
       while(digit > 0)
          {
              sum +=(digit%10);
              digit/=10;
          }
        return sum;
    }

void main()
 {
      char name[100], partner[100];
      int p,ns = 0, ps =0,love =54,i,j,love_percentage, opt;
      clrscr();

     do
     {
         printf("Enter Your Name: ");
         gets(name);

         printf("Enter Your Partner Name: ");
         gets(partner);

         for(i =0; i<strlen(name); i++);
            {
               ns += (tolower(name[i])-96);
            }

         for(j = 0; partner[j] != '\0'; j++)
            {
                ps+=(tolower(partner[j])-96);
            }
          p= Sum_of_Digits(ns);
          love_percentage = (Sum_of_Digits(ns)+Sum_of_Digits(ps)+love);
          printf("The Love Percentage is %d", love_percentage);
          printf("\nPress 1 To continue or 0 to Exit: ");
          scanf("%d",&opt);

    }
while(opt!=0);
    getch();
}

I also checked and took a reference from here, it shows some syntax error at the time of its execution.
Thanks

 
Reply
6/13/2023 11:35
Avatar
Aliciasmith
Member
Avatar
Aliciasmith:10/11/2023 10:27

Wow, this title caught my eye! It's fascinating to see how programming can be applied to matters of the heart. 💖 However, it's not uncommon to encounter errors in the development process. Debugging is an integral part of the journey towards creating flawless software. If you're facing challenges in your project, consider seeking professional help. Companies providing mobile application development services have experienced teams that can swiftly identify and resolve any issues, ensuring your Love Calculator app is up and running smoothly in no time! 🚀 Keep up the great work, and don't hesitate to reach out for support when needed. Happy coding!

 
Up Reply
10/11/2023 10:27
To maintain the quality of discussion, we only allow registered members to comment. Sign in. If you're new, Sign up, it's free.

2 messages from 2 displayed.