nevermind...
it's
#include<stdio. h>
int main (void)
{
int i, sum=0;
for (i=1; i<=21; i=i+2) {
(sum = sum + i);
printf("%d\n", i);
}
return 0;
}
User Profile
Collapse
-
loop code
hey,
i know that this is a really easy question...but i can't seem to figure out what's wrong with the code.. this function is meant to state every odd number.
#include<stdio. h>
int main (void)
{
int i, sum=0;
for (i=1; i<=21; i=i+2) {
(sum = sum + 1);
printf("%d\n",s um );
}
return 0;
} -
-
pointers...
Hey.
Can anyone tell me why we need pointers when swapping varibles such as:
void swap (int *x, int *y)
{
int temp;
temp = *x;
*x =*y;
*y = temp;
}
int x=12, y=4
swap (&x,&y);
why would they swap values, as opposed to using...
void swap (int x, int y)
{
int temp;
temp = x;
x =y;... -
I'm sorry. I have just started learning programming so I am trying to teach myself the basics with functions and strings.
My question is that how do i write something like "My name is Peter" and I get back "mynameispe ter" ?
How do i use the function?Leave a comment:
-
so, i think when you are using the remove_punc function, you have to write the script so that it keeps in the characters, while removing the punctions.Leave a comment:
-
remove punctuation in C
hey,
can anyone help me write up a function to remove space, semicolons, etc?
ty.
No activity results to display
Show More
Leave a comment: