CrazyEngineers
  • Love calculator

    Manish Goyal

    Manish Goyal

    @manish-r2Hoep
    Updated: Dec 25, 2024
    Views: 1.5K
    I hope most of you ceans
    must use love calculator to calculate love percentage
    here I am posting a code in java that will calculate love percentage
    with your partner
    //Program to calculate Love percentage

    import java.io.*;
    class Love
    {
    public static void main(String args[])
    {
    try
    {
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    System.out.println("Please enter name of boy");
    String s1=br.readLine();
    System.out.println("Please enter name of girl");
    String s2=br.readLine();
    int sum=0,sum2=0;
    for(int i=0;i<s1.length();i++)
    {
    char ch=s1.charAt(i);
    int ascii=ch;
    sum=sum+ascii;
    }
    for(int i=0;i<s2.length();i++)
    {
    char ch=s2.charAt(i);
    int ascii=ch;
    sum2=sum2+ascii;
    }
    int total=sum+sum2;
    int lovepercentage=total%100;
    System.out.println("love between "+s1+" and "+s2+" is "+lovepercentage+"%");
    }
    catch(Exception e)
    {
    System.out.print("Love calculator exception");
    }
    }
    }
    0
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Home Channels Search Login Register