Showing posts with label c. Show all posts
Showing posts with label c. Show all posts
Wednesday, February 18, 2015
C program to print ASCII value of a character
#include<stdio.h>
#include<conio.h>
void main()
{
int a;
char ch;
clrscr(); //to clear the screen
printf("Enter any character:");
scanf("%c",&ch);
a=ch;
printf("ASCII value of %c is %d",ch,a);
getch(); //to stop the screen
}
Tuesday, February 17, 2015
C Program to find cube of a number using function
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr(); //to clear screen
float cube(float); //function prototype
float a,cu;
cout<<"Enter any number:";
cin>>a;
cu=cube(a); //function calling
cout<<"
Cube of "<<a<<" is "<<cu;
getch();
}
float cube(float a)
{
float cu;
cu=a*a*a;
return(cu);
}
Subscribe to:
Posts (Atom)