User Profile

Collapse

Profile Sidebar

Collapse
khaichiew85
khaichiew85
Last Activity: Mar 5 '09, 03:17 PM
Joined: Feb 19 '09
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • khaichiew85
    replied to sum all odds number in array.
    in C
    re:

    im casting the input from the user to int.as a preventive way if user key in decimal numbers.
    only if it is an integer then it will store it as an array....
    See more | Go to post

    Leave a comment:


  • khaichiew85
    replied to sum all odds number in array.
    in C
    some refinement.

    solution is found but what if i want to change the do while loop into for loop?any suggestion?
    my refinement codes is as below:

    #include<stdio. h>
    #include<ctype. h>
    #include<stdlib .h>

    int sumAllOdd(int [],int i);

    int main (void)
    {
    double input;
    int count;
    int arr[100];


    printf("Please...
    See more | Go to post

    Leave a comment:


  • khaichiew85
    replied to Fibonacci with recursion
    in C
    i have tried ur code..no problem with that.
    But i would like to advise u that without detecting if the user want to continue by pressing 1 or Y or 2 or N.Use isdigit to differentiate them else if when alphabet is pressed the loop will keep on going
    See more | Go to post

    Leave a comment:


  • khaichiew85
    replied to how to use isDigit?
    in C
    Problem solved.
    if(!(isdigit(in put)))
    fflush(stdin);
    if( is_prime(input, 2))
    printf("\nThis number is PRIME\nThank you.\a\a\n\n");
    else
    printf("\nThis number is NOT PRIME\nThank you.\a\a\n\n");

    do{
    printf("Do you still want to continue?(Press 'Y' for YES or 'N' for No)\n");
    scanf ("%c",&optio n);

    fflush(stdin);...
    See more | Go to post

    Leave a comment:


  • khaichiew85
    started a topic how to use isDigit?
    in C

    how to use isDigit?

    im having a program.I want it to check if it is a character or integer is entered
    where shall i put the isDigit and how to use?i put it as highlighted below but got error.

    #include<stdio. h>
    #include<stdlib .h>
    #include<ctype. h>

    int is_prime( int input, int z);

    int main (void)
    {
    int input;
    char on;
    char option;

    printf("Press...
    See more | Go to post

  • khaichiew85
    replied to sum all odds number in array.
    in C
    problem stil exist..

    im quite new to write a program..After few days break,i try to do the coding once again.But problem is still there.Why my loop keep on repeating instead of jumping to the next statement?Does my recursive function there correct?

    #include<stdio. h>

    int sumAllOdd(int [],int );
    int main (void)
    {
    int i = 0;
    int input;
    int arr[100];
    char...
    See more | Go to post

    Leave a comment:


  • khaichiew85
    replied to sum all odds number in array.
    in C
    i can execute it already.but there are some errors there.Anyone can help?
    how to write it in recursion form?

    #include<stdio. h>

    int sumOdd(int arr[]);
    int main ()
    {
    int arr[100];
    int readNum;
    int sumAllOdd;
    int temp;
    int i;

    printf("You may enter up to 100 numbers.\nPleas e enter an integer:");
    scanf("%d",&rea dNum);...
    See more | Go to post

    Leave a comment:


  • khaichiew85
    replied to sum all odds number in array.
    in C
    i just click save and build project.then only i execute.which part i went wrong?any suggestion?
    See more | Go to post

    Leave a comment:


  • khaichiew85
    replied to sum all odds number in array.
    in C
    re:When i try to execute the program

    when i try to execute the program i got the error "The system cannot find the file specified"
    See more | Go to post

    Leave a comment:


  • khaichiew85
    started a topic sum all odds number in array.
    in C

    sum all odds number in array.

    i am trying to write a C code which request input from user and store them in array.Number of inputs is determined by the user and it is limited to 100 inputs.Then I need to pass the array to recursive function to sum all odd values in the array.Finally,r eturn the sum of all odd numbers to the user.

    However, i got the error which stated that the system cannot find the file specified.
    So I am not sure if my code is correct....
    See more | Go to post
No activity results to display
Show More
Working...