# C program to find LovePercentage between anytwo Names

## C program to find LovePercentagebetween 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
{
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 Partner Name:    Rathiv

Press 0 to exit, and 1 to continue: 1