dulvinrivindu's Profile User Rating: -----

Reputation: 2 Apprentice
Group:
Active Members
Active Posts:
52 (0.05 per day)
Joined:
25-September 12
Profile Views:
514
Last Active:
User is offline May 13 2015 10:04 AM
Currently:
Offline

Previous Fields

Country:
SL
OS Preference:
Who Cares
Favorite Browser:
Chrome
Favorite Processor:
Intel
Favorite Gaming Platform:
Who Cares
Your Car:
Who Cares
Dream Kudos:
0
Icon   dulvinrivindu Just started Learning JAVA

Posts I've Made

  1. In Topic: UnboundLocalError

    Posted 5 Apr 2014

    Is it bad to pass values or objects to a function?
    And i corrected the issue. Thanks alot
  2. In Topic: Error in the algorithm and can't find the error.

    Posted 9 Sep 2013

    View Postvividexstance, on 09 September 2013 - 12:05 PM, said:

    Have you run the program through a debugger or maybe place a few output statements in the code to see how the algorithm is working?

    I edited the code like this
    /*To find the biggest palindromic number
     *of a product of 2 3-digit numbers.
     */
     #include <stdio.h>
     int main()
     {
        FILE * Output;
        Output = fopen("data.txt", "a");
    
        int x,y,result = 0,palindrom = 0;
        for(x = 100;x < 400;x++)
        {
            for(y = 100;y < 400;y++)
            {
                result = x * y;
                int count = 0;
                while(result != 0)
                {
                    result /= 10;
                    count++;
                }
                result = x * y;
                int check[count];
                int ini = count;
                while(ini > 0)
                {
                    check[ini-1] = 0;
                    ini--;
                }
                int z;
                for(z = count;z > 0;z--)
                {
                    check[z-1] = result % 10;
                    result /= 10;
                }
                if((count % 2) == 0)
                {
                    if((check[0] == check[5]) && (check[1] == check[4]) && (check[2] == check[3]))
                        palindrom = x * y;
                fprintf(Output,"even %d\n",palindrom);
                }
                if((count % 2) != 0)
                {
                    if((check[0] == check[4]) && (check[1] == check[3]))
                        palindrom = x * y;
                        fprintf(Output,"odd %d\n",palindrom);
                }
            }
        }
        fclose(Output);
        printf("%d",palindrom);
        return 0;
     }
    
    

    and ill attach the output file

My Information

Member Title:
D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Location:
Matara, Sri Lanka
Interests:
In Programming
Learning CIMA
Full Name:
Dulvin Rivindu Hakmana Witharane
Years Programming:
0
Programming Languages:
JAVA

Contact Information

E-mail:
Private
Skype:
Skype  dulvin.witharane

Friends

dulvinrivindu hasn't added any friends yet.

Comments

dulvinrivindu has no profile comments yet. Why not say hello?