the code is like this:
#include<stdio.h>
int main(void)
{
float average;
int flag=0;
int c=0;
int word=0;
char ch;
printf("pls enter your sentence:");
while ((ch=getchar())!=EOF)
{
if(ch!=' '&&ch!='\n')
c++;
if(ch!='...
I have writen this code here:
while (ch=getchar()!=EOF)
{
if(ch=='\n'||ch==' ')
continue;
else
{
counter1=0;
while(counter1<=1000)
{
counter=0;
while(counter<=1000000)
{...
I tried to type in a letter "A" when I use the following code,
scanf("%d",&choice);//I entered 'A'
printf("%d",choice);//I get 32 here!
and choice is integer which is 32 bits, can anyone tell me what happened when the letter is keyed in? if I entered 'A', scanf("%d",&choice); is evaluated as...
this is part of the code:
while((ch=getchar())!='#')
{
if(ch=='.')
{
putchar('!');
count++;
}
if(ch=='!')
{
printf("!!");
count++;
}
else
putchar(ch);
}
I thought the "else" is associated with the second "if", but...
#include<stdio.h>
int main(void)
{
float c;
printf(" pls key in your code:");
scanf("%f",&c);
printf("the output is %f or %e",c,c);
system("pause");
return 0;
}
after I have compiled the code above, I typed in 21.29, and what I get is "the output is 21.290001 or 2.129000e+001", why I got the...
what happened when I use %d in printf() to display a long int or unsigned number? consider the code below:
#include<stdio.h>
int main(void)
{
unsigned un=40000;
printf("un=%u and not %d",un,un);
return 0;
}
and what I get is "un=40000 and not -25536", what was going on here?
thanks for help.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.