Hello
Please can anyone tell me how can i print prime numbers from 1 to 99 using basic C functions like "sprintf, for, if" in ge?
+1 for anyone who helps me
// this is only an example of how to strcat a bunch of integers into one string
// needs to be run in a text actor
char final[255] = {0};
char buffer[10] = {0}; // to hold the numbers
int temp = 5;
sprintf(buffer, "%d, ", temp); // set buffer to be the number
strcat(final, buffer); // add buffer to the end of final
temp = 10;
sprintf(buffer, "%d, ", temp); // set buffer to be the number
strcat(final, buffer); // add buffer to the end of final
// and so on
sprintf(text, "%s", buffer); // set the text to show the result
// from this code it should display the string "5, 10, "
- Code: Select all
sprintf(text, "%s", buffer);
- Code: Select all
sprintf(text, "%s", final);
Users browsing this forum: No registered users and 1 guest