C program to find Love Percentage between any two Names

C program to find Love Percentage between any two Names

This page has a C program to find Love Percentage between any two Names. We can easily write the C program to C program to find the Love Percentage between names. Here the C program will ask only two names. If the names are not gieven, then the output of the program will be zero.. The below given C program is used to calculate the Love percentage. Kindly check out the program.

Love Percentage between any two Names


  #include <stdio.h>
  #include <string.h>
  #include <ctype.h>
  int sumdigits(int n){
          int sum=0;
          while(n > 0)
          {
          sum += (n % 10);
          n /= 10;
         }
         return(sum);
         }

int main(){
         int a, con, s1=0, s2=0, result=0;
         char yourname[50], pname[50];
         do
         {
         printf("Kindly Enter Your Name: ");
         fflush(stdin);
         gets(yourname);
         printf("Kindly Enter Your Partner Name: ");
         fflush(stdin);
         gets(pname);
         for(a=0;a<(strlen(yourname));a++)
        {
         s1+=tolower(yourname[a]);
         }
         for(a=0;a<(strlen(pname));a++)
        {
        s2+=tolower(pname[a]);
        }
        if((s1+s2)>0){
        result=(sumdigits(s1)+sumdigits(s2))+40;
        s1=0;
        s2=0;
        }
        else
        result=0;
        if(result>100)
        result = 100;
        printf("\n Your love percentage is: %d \n\n",result);
        printf("\n Press 0 to exit, and 1 to continue: ");
        scanf("%d",&con);
        }while(con!=0);
        return(0);
        }


Sample Output:

Kindly Enter Your Name:     Mathiya
Kindly Enter Your Partner Name:    Rathiv
Your love percentage is   75

Press 0 to exit, and 1 to continue: 1

Kindly Enter Your Name:     Mahiya

Kindly Enter Your Partner Name:    Tivaathiv
Your love percentage is :   74

Press 0 to exit, and 1 to continue: 0


Other Popular Converter Calculators

About Er. T.Tharesh Kumar

I am a Professor and Head of Department of Computer Science in an Arts and Science College. I have designed this website to provide solved example programs of different categories for all the school and college going students to learn C language deeply, and to practice Interview based Multiple Choice (Objective Type) questions and answers.

Other Related C Programs :


* C Program to find whether the given number is Odd or Even

* C Program to find the Sum of Odd Digits

* C Program to find the Sum of Even Digits

* C Program to find the Sum of Even and Odd Digits,

* C Program to Display Odd digits

* C Program to Display even digits

* C Program to Display Odd Numbers,

* C Program to Display Even Numbers,

* C Program to Check whether the given number is Armstrong number

* C Program to display the Armstrong numbers in Range

* C Program to display the Armstrong numbers between 1 and 1000

* C Program to check perfect number, perfect numbers in range

* C Program to Check Prime number, Prime numbers between 1 and 100

* C Program to display the Prime numbers in a Range

* C Program to display the Sum of Prime numbers

* C Program to Check Strong number

* C Program to display the Strong number in Range

* C Program to Check whether the given number is polindrome number or not

* C Program to Check polindrome number using for loop

* C Program to Check polindrome number using Recursion

* C Program to  check whether the given string is polindrome or not

* C Program to find the Roots of Quadratic equation

* C Program to display Fibonacci Series

* C Program to display the Fibonacci Series using an array

* C Program to display the Fibonacci Series using while loop

* C Program to find the Sum of Fibonacci Series, Factorial of Number

* C Program to find the Factorial without using Recursion

* C Program to find the Factorial using Pointers

* C Program to find the Factorial using Function

Bookmark and Share