//Output of Integers
//Downloaded from www.c4cprog.co.nr
#include<conio.h>
void main()
{
int m=12345;
long int n=9876543;
clrscr();
printf("%d\n",m);
printf("%10d\n",m);
printf("%010d\n",m);
printf("%-10d\n",m);
printf("%10ld\n",n);
printf("%10ld\n",-n);
getch();
}
Programs Can Also Be Downloaded From The Folders Below....[Or Scroll Down]
Showing posts with label For Beginners. Show all posts
Showing posts with label For Beginners. Show all posts
Predict Output
Click Here To Download C File Of This Program
Checking If Statements
Click Here To Download C File Of This Program
//Program for Checking Nestyed If, Else if Ladder & Conditional Statements.
//Downloaded from www.c4cprog.co.nr
#include<conio.h>
void main()
{
int y,x,w;
clrscr();
printf("\n\nEnter The Val of X :");
scanf("%d",&x);
clrscr();
printf("\nEnter Your Choice\n1.Else If Ladder\n2.Nested If\n3.Conditional Operator\n\n");
scanf("%d",&y);
switch(y)
{
case 1:
if(x<0)
printf("\ny=1");
else
if(x==0)
printf("\ny=0");
else
if(x>0)
printf("\ny=-1");
break;
case 2:
if(x!=0)
{
if(x>0)
printf("\ny=-1");
else
printf("\ny=1");
}
else
printf("\ny=0");
break;
case 3:
(x!=0)?((x<0)?(w=1):(w=-1)):(w=0);
printf("\ny=%d",w);
break;
default :
printf("\nInvalid Choice !!!\n");
break;
}
getch();
}
/*
Enter The Val Of X : 5
Enter Your Choice
1.Else If Ladder
2.Nested If
3.Conditional Operator
1
y=-1
0
y=0
3
y=-1
*/
Print equation of Line
Click Here To Download C File Of This Program
//Program 5 - To Display eq. of line in form ax+by=c
//Downloaded from www.c4cprog.co.nr
#include<conio.h>
void main()
{
int a=5,b=8,c=18;
clrscr();
printf("The Equation is : %dx+%dy = %d",a,b,c);
getch();
}
Verify different Datatypes
Click Here To Download C File Of This Program
//Program to verify different datatypes
//Downloaded from www.c4cprog.co.nr
#include<conio.h>
void main()
{
int a;
float f;
clrscr();
printf("Enter INT & FLOAT\n");
scanf("%i%f",&a,&f);
printf("\n \nDecimal = %d\nUnsigned decimal = %u\nHexadecimal Integer = %x",a,a,a);
printf("\nFloat = %f\nOctal = %o\nFloat = %e\nOctal = %i\nDecimal = %i\nHexadecimal = %i\n",f,a,f,a,a,a);
getch();
}
Cout +ve & -ve Nos
Click Here To Download C File Of This Program
//Count +ve nd -ve Nos
//Downloaded from www.c4cprog.co.nr
#include<conio.h>
void main()
{
int l,pos=0,neg=0,a,n=0,p=0;
clrscr();
printf("\nEnter Limit :");
scanf("%d",&l);
while(l>0)
{
scanf("%d",&a);
if(a>0)
{ p++;
pos=pos+a; }
if(a<0)
{
n++;
neg=neg+a;
}
l--;
}
printf("\n\tThe Total +ve Nos. : %d",p);
printf("\n\tThe Sum of +ve Nos. : %d",pos);
printf("\n\tThe Total -ve Nos. : %d",n);
printf("\n\tSum of -ve Nos. : %d",neg);
getch();
}
Convert Celcius To Farenheit & vice versa
Click Here To Download C File Of This Program
<pre style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;padding:0px;color:#000000;text-align:left;line-height:20px;"><code style="color:#000000;word-wrap:normal;"> //Program 4 - To Convert Celcius to Farenheit & Vice Versa
//Downloaded from www.c4cprog.co.nr
#include<conio.h>
void main()
{
float f,c;
clrscr();
printf("Enter Temperature in Celcius : ");
scanf("%f",&c);
f=(1.8*c)+32;
printf("\nTemperature in Farenheit : %f",f);
printf("\n\nEnter Temperature in Farenheit : ");
scanf("%f",&f);
c=(f-32)/1.8;
printf("\nTemperature in Celcius : %f",c);
getch();
}
</code></pre>
Arithmetic Operations
Click Here To Download C File Of This Program
//ARITHMETIC OPERATIONS
//Downloaded from www.c4cprog.co.nr
#include<conio.h>
void main()
{
int a,b,sum,diff,mult,mod;
float div;
clrscr();
printf("Enter Numbers A & B :\n");
scanf("%d%d",&a,&b);
sum=a+b;
diff=a-b;
mult=a*b;
div=a/b;
mod=a%b;
printf("\nResult\n\nSum = %d\nDifference = %d\nProduct = %d\nQuotient = %f\nRemainder = %d\n",sum,diff,mult,div,mod);
getch();
}
Area Of Circle
Click Here To Download C File Of This Program
//Program 3 : Area of Circle from Radius
//Downloaded from www.c4cprog.co.nr
#include<conio.h>
#define pi 3.14
void main()
{
int r;
float a,c;
clrscr();
printf("Enter The Radius \n");
scanf("%d",&r);
a=pi*r*r;
c=2*pi*r;
printf("The Area is : %f",a);
printf("\nThe Circumference is : %f",c);
getch();
}
Add 2 nos.
Click Here To Download C File Of This Program
//Program 2 to add 2 Nos.
//Downloaded from www.c4cprog.co.nr
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
printf("Enter 2 Nos. : ");
scanf("%d%d",&a,&b);
c=a+b;
printf("The Sum is : %d",c);
getch();
}
Subscribe to:
Posts (Atom)


