Friday, November 28, 2014

Simple c pro



Reverse Number

#include
#include
void main ()
{
int no,r,res;
clrscr ();
printf ("Enter any value: ");
scanf ("%d",&no);
r=res=0;
while (no>0)
{
r=no%10;
no=no/10;
res=(res*10)+r;
}
printf ("\nReverse is %d",res);
getch ();
}

Value of data type

#include
#include
void main ()
{
int a=10;
float d=40.50;
char ch='A';
double dbl=78.9786;
long lng=7897711;
char nm [10]="Jimmy";
clrscr ();
printf ("\nInteger value is %d",a);
printf ("\nFloat value is %.2f",d);
printf ("\nCharacter value is %c",ch);
printf ("\nDouble value is %.4lf",dbl);
printf ("\nLong value is %ld",lng);
printf ("\nString value is %s",nm);
getch ();
}
Password verification

#include
#include
void main ()
{
int pass;
clrscr();
do
{
printf ("Enter Password to see the detail of programmer:\n");
scanf ("%d",&pass);
}
while (pass!=464);
printf ("\nJagjeet Singh");
printf ("\nB.Sc. (I.T.)\nPunjab Technical University");
getch ();
}


No comments:

Post a Comment