Get Email Subscription

Enter your email address:

Delivered by FeedBurner

Sunday, January 3, 2010

Unformatted Output Function



































Unformatted Output FunctionHeader FileUse of the function
1) putch( );conio.hIt print the single character on the screen.
2) putchar( );stdio.hIt print the single character on the screen.
3) puts();stdio.hIt print the string completely on the screen.
4) sqrt(n);math.hIt print the square root of a non-negative number.
5) pow(x , y );math.hIt print the value of x rest to y.
read more "Unformatted Output Function"

Unformatted Input Function






























Unformatted Input FunctionHeader FileUse of the function
1) getch( );conio.hIt reads the typed single character instantly but does not echo / display it on the screen. Enter key is not required
2) getche( );conio.hIt reads the typed single character instantly and echoes / displays it on the screen. Enter key is not required.
3)getchar();stdio.hIt reads the typed single character only after hitting the enter key. It echoes / display the character on the screen.
4) gets();stdio.hIt reads the typed string completely only after hitting the enter key. It echoes the string on the screen
read more "Unformatted Input Function"

Saturday, January 2, 2010

Write a program in 'C' to enter any positive number and to calculate and print its square and cube



#include<stdio.h>
#include<conio.h>
#include<math.h>
main()
{
float n, s, c;
printf("Enter any positive number\n");
scanf("%f", &n);
s = pow(n , 2);
c = pow(n , 3);
printf("The Square is %f\n", s);
printf("The Cube is %f\n", c);
return(0);
}

For eg :-

Output :-
Enter any positive number
2.5
The Square is 6.250000
The Cube is 15.6250000
read more "Write a program in 'C' to enter any positive number and to calculate and print its square and cube"

Write a program in 'C' enter a positive number and to calculate and print its square root (sqrt)



#include<stdio.h>
#include<conio.h>
#include<math.h>
main()
{
float n, s;
printf("Enter any positive number\n");
scanf("%f", &n);
s = sqrt(n);
printf("The Square root of %f is %f\n", n, s);
return(0);
}

For eg :-

Output :-
Enter any positive number
25
The Square root 25 is 5.000000
read more "Write a program in 'C' enter a positive number and to calculate and print its square root (sqrt)"

Mathematical header file <math.h>

<math.h> :- It means the mathematical header file which has some special mathematics function namely sqrt( ); and pow( , );

1) sqrt( ); It means the square root function. The format is sqrt(n); where n should not be negative

2) pow( , ); It means the power function. The format is pow(x , y); where x is base and y is the power i.e. pow(x , y) = x rest to y
read more "Mathematical header file <math.h>"

In a firm the employee gets house rent allowance as 10% of Basic pay and the Provident fund as 8.33% of Basic pay.

Write a program in 'C' to enter the basic pay (bp), to calculate and print the house rent (hra), the provident fund (pf) and net salary is (ns).



#include<stdio.h>
#include<
conio.h>
main()
{
int bp;
float hra, pf, ns;
clrscr();
printf("Enter the Basic Pay\n");
scanf("%d", &bp);
hra = bp*10/100;
pf = bp*8.33/100;
ns = bp+hra-pf;
printf("The hra is Rs. %f\n", hra);
printf("The pf is Rs. %f\n", pf);
printf("The Net Salary is Rs. %f\n", ns);
return(0);
}
read more "In a firm the employee gets house rent allowance as 10% of Basic pay and the Provident fund as 8.33% of Basic pay."

Friday, January 1, 2010

Unformatted Input Function



























Unformatted Input Function
Input Function
Header File
Use of the function
1) getch( );
conio.h

It reads the typed single character instantly but does not echo / display it on the screen. Enter key is not required
2) getche( );
conio.h
It reads the typed single character instantly and echoes / displays it on the screen. Enter key is not required.

3) getchar();
stdio.h

It reads the typed single character only after hitting the enter key. It echoes / display the character on the screen.






4)gets();
stdio.h
It read the typed string completely only after hitting the enter key. It echoes the string on the screen

read more "Unformatted Input Function"

About This Blog

Lorem Ipsum

  © Blogger templates Newspaper III by Ourblogtemplates.com 2008

Back to TOP