C Program to demonstrate strspn function.

Write a C Program to demonstrate strspn function.
The strspn() function returns the index of the first character in string1 that doesn’t match any character in string2. If all the characters of the string2 matched with the string1, strspn returns the length of the string1. Read more about C Programming Language .

/***********************************************************
* You can use all the programs on www.c-program-example.com
* for personal and learning purposes. For permissions to use the
* programs for commercial purposes,
* contact [email protected]
* To find more C programs, do visit www.c-program-example.com
* and browse!
*
* Happy Coding
***********************************************************/

#include<stdio.h>
#include<string.h>
#include<conio.h>
int main()
{
int spn;
char str1[] = "1234hjbcde09i";
char str2[] = "12345";
char str3[] = "a12d3456fd";
char char_list[] = "1234567890";
clrscr();
//It returns 4
spn = strspn (str1,char_list);
printf ("nnThe length of the initial numbers for str1 is %d.n",spn);

//It returns 5
spn = strspn (str2,char_list);
printf ("nThe length of the initial numbers for str2 is %d.n",spn);

//It returns 0
spn = strspn (string3,char_list);
printf ("nThe length of the initial numbers for string3 is %d.n",spn);
return 0;
}

Read more c programs
C Basic
C Strings

You can easily select the code by double clicking on the code area above.

To get regular updates on new C programs, you can Follow @c_program

You can discuss these programs on our Facebook Page. Start a discussion right now,

our page!

Share this program with your Facebook friends now! by liking it

(you can send this program to your friend using this button)

Like to get updates right inside your feed reader? Grab our feed!

To browse more C Programs visit this link
(c) www.c-program-example.com

C program to demonstrate ceil function.

Write a C program to demonstrate ceil function.ceil is in the C math.h library.
ceil function rounds up the smallest next integral value.
Example:ceil(2.0) is 2.0
ceil(2.1) is 3.0
ceil(2.2) is 3.0


ceil(2.9) is 3.0
Read more about C Programming Language.

/***********************************************************
* You can use all the programs on www.c-program-example.com
* for personal and learning purposes. For permissions to use the
* programs for commercial purposes,
* contact [email protected]
* To find more C programs, do visit www.c-program-example.com
* and browse!
*
* Happy Coding
***********************************************************/




#include<stdio.h>
#include<math.h>
#include<conio.h>
int main()
{
double number, result;
clrscr();
printf("Enter a number to round it upn");
scanf("%lf",&number);

result = ceil(number);

printf("nOriginal number = %lfn", number);
printf("nNumber rounded up = %lfn", result);
getch();
return 0;
}
Read more Similar C Programs
Learn C Programming

Number System

You can easily select the code by double clicking on the code area above.

To get regular updates on new C programs, you can Follow @c_program

You can discuss these programs on our Facebook Page. Start a discussion right now,

our page!

Share this program with your Facebook friends now! by liking it

(you can send this program to your friend using this button)

Like to get updates right inside your feed reader? Grab our feed!

To browse more C Programs visit this link
(c) www.c-program-example.com

C program to draw a circle using c graphics.

Write C program to draw a circle using c graphics.
In this program we use the graphics.h library function to draw a circle. To use graphics.h, we have to install the drivers in to the the system by using the initgraph() function. In the program circle is the graphic function , which takes three parameters, first two are co-ordinates and the third one is the radius of the circle. Read more about C Programming Language.

/***********************************************************
* You can use all the programs on www.c-program-example.com
* for personal and learning purposes. For permissions to use the
* programs for commercial purposes,
* contact [email protected]
* To find more C programs, do visit www.c-program-example.com
* and browse!
*
* Happy Coding
***********************************************************/

#include <graphics.h>

main()
{
int gd = DETECT, gm;
initgraph(&gd, &gm, "C:\TC\BGI");

circle(25, 25, 100);

getch();
closegraph();
return 0;
}
Read more Similar C Programs
Learn C Programming

Number System

You can easily select the code by double clicking on the code area above.

To get regular updates on new C programs, you can Follow @c_program

You can discuss these programs on our Facebook Page. Start a discussion right now,

our page!

Share this program with your Facebook friends now! by liking it

(you can send this program to your friend using this button)

Like to get updates right inside your feed reader? Grab our feed!

To browse more C Programs visit this link
(c) www.c-program-example.com