[ create a new paste ] login | about

Link: http://codepad.org/OGPzzgjQ    [ raw code | output | fork ]

C, pasted on May 20:
#include<stdio.h>
#include<conio.h>
#include<string.h>

int main()
{
	char s[] = "        Nguyen    Viet           Nam    Son  dep trai co  mai     ra an duoc khong ?"; 

	// Xử lý
	int length = strlen(s);
	int dem = 0;  // Mặc định tính từ đầu tiên
	for(int i = 0; i < length; i++)
	{
		if(s[i] == ' ' && s[i + 1] != ' ')
		{
			dem++;
        }
	}
	printf("\nSo tu = %d",dem);


	getch();
	return 0;
}


Output:
1
2
3
Line 17: error: conio.h: No such file or directory
In function 'main':
Line 12: error: 'for' loop initial declaration used outside C99 mode


Create a new paste based on this one


Comments: