Own free website with 1 GB free space?
 


IN 1903 , as the first powered human flight swept the OHIO sky, Wilbur and orville Wright redefinr=ed human capabilities to shrink the world.even after 9 decades ,the idea invogorates our value system and inspires us to put the world at our arm distance.this proactive approach of our enterprise solutions led m@de4u.page.tl ,the only website provisioning ability by youngsters ,on a multitude of internet based services. Hope ull surely enjoy stay on the website! A WARM WELCOME TO ALL U GUYS , THIS IS SHASHANKK 4M SVIT. THIS WEBSITE I SOLELEY INTENDED FOR GUYS 4M ALL YEARS TO HAVE THEIR SOURCE 4 LEARNING, BUT I HAVE STARTED MINE JOB WITH ITSELF FIRST YEAR GUYS, SO DO NAVIGATE THEM THEY MIGHT BE USEFUL TO U!!!







only search google.com




THIS IS SPECIALLY DESIGNED BY SHASHANKK JUST4U ,SO ENJOY YOUR STAY ON THIS WEBSITE AND REAP MAXIMUM BENIFITS OF IT

*


Today, there have been 9 visits (87 hits) on this page! //-->

made 4 u . COM

BASIC C PROGRAMS

YOU ARE NOW IN 'C' LANGUAGE'S PROGRAM SECTION, WHERE U CAN NEARLY HAVE ALL PROGRAMS OF C LANGUAGE .............COMPILED BY SHASHANKK.A.CHINCHLI


 
This website was created for free with Own-Free-Website.com. Would you also like to have your own website?
Sign up for free

1. HELLO WORLD- JUST BEGINNING

#include < stdio.h >
#include < conio.h >
void main()
{
clrscr();
printf("Hello");
printf("n");
printf("Hello");
getch();
}


2.NAME INPUT AND OUT PUT

#include < stdio.h >
#include < conio.h >
void main()
{
char name;
clrscr();
printf("Enter Name : ");
scanf("%s",name);
printf("nName is : %s",name);
getch();
}


3. FUNCTION FOR ODD~EVEN NUMBER (as well as intoduction to relational operators)

Relational Operator
>
>=
<=
==
no1=5
no2=3
no1>no2 = true 1
false 0
Control Statement
no=5
rem = no%2
if(condition)
{
}
if - else
if(condition)
{
}
else
{ }



#include< stdio.h >
#include< conio.h > void main() { int no;
int rem;
clrscr();
printf("Enter No : ");
scanf("%d",&no);
rem = no%2;
if(rem==0) //if(no%2==0) { printf("n%d is even",no);
}
else { printf("n%d is odd",no);
}
getch();
}



4. INTRODUCTION TO BITWISE OPERATOR

/*
Bitwise Operator
&
|
!
<< shift left
>
>
shift right
a=5 101
b=3 011
& 001 = 1
| 111 = 7
^ 110 =6
a=101 =5
1010=10
a=101
10=2
1=1
*/
#include< stdio.h >
#include< conio.h >
void main()
{ int a=5,b=3,c; clrscr();
c = a&b; printf("C(a&b) : %d",c);
c= a|b; printf("nC(a|b) : %d",c);
c=~a; printf("nC(~a) : %d",c);
c = a^b; printf("nC(a^b) : %d",c);
c=a<<2; printf("nC(a<<1) : %d",c);
c=a>>2; printf("nC(a>>2) : %d",c);
getch();
} }


5. INTODUCTION TO TERNARY OPERATOR

/*
condition?true:false
*/
#include< stdio.h >
#include< conio.h >
void main()
{
int no1,no2,max;
clrscr();
printf("Enter No1 : ");
scanf("%d",&no1);
printf("Enter No2 : ");
scanf("%d",&no2);
max = (no1>no2)?no1:no2;
printf("nMAX : %d",max);
getch();
}


6. INTODUCTION TO GOTO OPERATOR

#include< stdio.h >
#include< conio.h >
/*
label:
goto label; */
void main()
{
int no;
clrscr();
back:
printf("Enter No : ");
scanf("%d",&no);
if(no%2==0)
goto back;
printf("nNO is : %d",no);
getch();
}


7. W.A.P TO CHECK WHETHER ENTERED DATA IS NUMBER OR DIGIT

#include< ctype.h >
{
char ch;
clrscr();
ch = getchar();
if(isalpha(ch)>0)
{

printf("It is character.");
}
else if(isdigit(ch)>0)
{
printf("It is digit");
}
else
{

printf("It is not character and not digit.");
}
getch();
}


8. W.A.P TO CHECK WHETHER ENTERED NUMBER IS A LEAP YEAR OR NOT

#include< stdio.h >
#include< conio.h >
void main()
{
int a;
clrscr();
printf("Enter the year:");
scanf("%d",&a);
if (a%4==0)
{
printf("IT is a leap year");
}
else if (a@0==0 && !(a0==0))
{
printf("IT is a leap year"); }
else
{
printf("It is not a leap year");
}
getch();
}


9.W.A.P TO CTEATE A SIMPLE CALCULATOR USING RELATIONAL OPERATOR

/*
This program read the no from user and display it
Arithmetic operator
+
-
*
/
%
5/3 = 1
5%3 = 2
*/
#include< stdio.h >
#include< conio.h >
void main()
{
int a,b;
int sum,sub,mul,div,mod;
// int b;
clrscr();
printf("Enter No1 : ");
//To get the no from user
scanf("%d",&a);
printf("Enter No2 : ");
scanf("%d",&b);
sum = a+b;
sub =a-b;
mul = a*b;
div = a/b;
mod = a%b;
printf("nNo1 is : %d",a);
printf("nNo2 is : %d",b);
// printf("nADDITION : %d",sum);
printf("nAddition of %d and %d is %d",a,b,sum);
printf("nSUBTRACTION : %d",sub);
printf("nMULTIPLICATION : %d",mul);
printf("nDIVISION : %d",div);
printf("nMODULO : %d",mod);
getch();

}




10. SWAPPING OF NUMBERS

#include
#include
void main()
{
int a=4,b=3,temp;
clrscr();
printf("n before A:%d t B:%d",a,b);
temp=a;
a=b;
b=temp;
printf("n after A:%d t B:%d",a,b);
getch();
}


11. W.A.P FOR ADDITION OF ALL DIGITS IN A GIVEN NUMBER

#include< stdio.h >
#include< conio.h >
void main()
{
int no,sum,rem;
clrscr();
sum=0;
printf("ENTER NO :");
scanf("%d",&no);
while(no>0)
{
rem = no % 10;
sum + = rem;
no / = 10;
}
printf("THE SUM OF DIGITS IS :%d",sum);
getch();

}


12. W.A.P TO PRINT REVERSE OF A NUMBER SO ENTERED BY THE USER

#include< stdio.h >
#include< conio.h >
void main()
{
int no,sum,rem;
clrscr();
sum=0;
printf("ENTER NO :");
scanf("%d",&no);
while(no>0)
{
rem = no % 10;
sum = ( sum * 10 )+ rem;
no / = 10;

} printf("n REVERSE IS %d",sum);
getch();

}


13. W.A.P TO CHECK WHETHER A NUMBER SO ENTERED IS ARMSTRONG NUMBER, EXAMPLE IS 153=1*1 + 5*5 + 3*3

#include< stdio.h >
#include< conio.h >
void main()
{
int no,temp,sum,rem;
clrscr();
printf("n Enter the No.:");
scanf("%d",&no);
temp=no;
sum=0;
while(no>0)
{ rem = no % 10;
sum = sum + ( rem * rem * rem);
no = no / 10; } if( temp == sum)
{ printf("n %d is armstrong",temp);
else
{ printf("n %d is not armstrong",temp); }
getch();

}


14.W.A.P TO GET BASE AS WELL AS POWER FROM THE USER AND ITS VALUE

#include< stdio.h >
#include< conio.h >
void main()
{
int a,b,temp=1,i;
clrscr();
printf("n Enter a & b for a^b:");
scanf("%dt%d",&a,&b);
for(i=1;i<=b;i++)
{ temp=temp*a; }
printf("n RESULT IS:%d",temp);
getch();

}