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....
User Profile
Collapse
-
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...Leave a comment:
-
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 goingLeave a comment:
-
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);...Leave a comment:
-
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... -
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...Leave a comment:
-
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);...Leave a comment:
-
i just click save and build project.then only i execute.which part i went wrong?any suggestion?Leave a comment:
-
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"Leave a comment:
-
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....
No activity results to display
Show More
Leave a comment: