Showing posts with label program. Show all posts
Showing posts with label program. Show all posts

Wednesday, February 18, 2015

C program to print ASCII value of a character

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
}
Read more »

Tuesday, February 17, 2015

C Program to find cube of a number using function

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);
}
Read more »