Learn C With Me Beginners C Tutorial

July 16th, 2012 | No Comments | Posted in Programming, Science & Technology

//w.a.p to take two numbers and performs addition,subtraction,multiplication,division.

#include
#include
void main()
{
float a,b;
clrscr();
printf(“enter 1st number”);
scanf(“%f”,&a);
printf(“enter 2nd number”);
scanf(“%f”,&b);
printf(“Result of Addition is %f”,a+b);
printf(“\nResult of Subtraction is %f”,a-b);
printf(“\nResult of Multiplication is %f”,a*b);
printf(“\nResult of division is %f”,a/b);
getch();

}

//w.a.p to take Celious Temprature and convert to Feranhite Temprature.

#include
#include
void main()
{
float fer,cel;
clrscr();
printf(“Enter Celious Temprature”);
scanf(“%f”,&cel);
fer=(9*cel+160)/5;
printf(“Feranhite temprature is:%f”,fer);
getch();

}

//w.a.p to take a number and check the number is even or odd
#include
#include
void main()
{
int num;
clrscr();
printf(“Enter a number:”);
scanf(“%d”,&num);
if(num%2==0)
{
printf(“%d is Even”,num);
}
else
{
printf(“%d is Odd”,num);

}
getch();
}

//w.a.p to take two number and check the number is equal or not.

#include
#include
void main()
{
float num1,num2;
clrscr();
printf(“Enter 1st number:”);
scanf(“%f”,&num1);
printf(“Enter 2nd number:”);
scanf(“%f”,&num2);
if (num1==num2)
{
printf(“both numbers are equal”);
}
else
{
printf(“both numbers are not equal”);

}
getch();
}

//w.a.p to take Feranhite Temprature and convert to Celious Temprature.

#include
#include
void main()
{
float cel,fer;
clrscr();
printf(“Enter Feranhite Temprature:”);
scanf(“%f”,&fer);
cel=(5*fer-160)/9;
printf(“Temprature of Celious is:%f”,cel);
getch();
}

//w.a.p to take two number and check the number is greater or smaller

#include
#include
void main()
{
float num1,num2;
clrscr();
printf(“Enter 1st number:”);
scanf(“%f”,&num1);
printf(“Enter 2nd number:”);
scanf(“%f”,&num2);
if (num1>num2)
{
printf(“%f is greater and %f is smaller”,num1,num2);
}
else
{
printf(“%f is greater and %f is smaller”,num2,num1);
}
getch();
}

//w.a.p to take principle,time,rate and find interest

#include
#include
void main()
{
float pri,tim,rat,interest;
clrscr();
printf(“Enter Principle”);
scanf(“%f”,&pri);
printf(“Enter Time”);
scanf(“%f”,&tim);
printf(“Enter Rate”);
scanf(“%f”,&rat);
interest=(pri*tim*rat)/100;
printf(“Interest is : %f”,interest);
getch();
}

//w.a.p to describe about c language.

#include
#include
void main()
{
clrscr();

printf(“\n\”C is a Programming language devloped at AT & T’s Bell Laboratories of USA in 1972.it was designed and written by a Dennis Ritchie\”");
getch();
}

//w.a.p to take a number and a power and find result.

#include
#include
#include
void main()
{
float num,pw,res=0;
clrscr();
printf(“Enter Number:”);
scanf(“%f”,&num);
printf(“Enter Power”);
scanf(“%f”,&pw);
res=pow(num,pw);
printf(“Result is:%f”,res);
getch();
}

//w.a.p to take a number and find square root of a number.

#include
#include
#include
void main()
{
float a;
clrscr();
printf(“enter a number”);
scanf(“%f”,&a);
printf(“Square root of a number is %f”,sqrt(a));
getch();

}

//w.a.p to print your name and address.

#include
#include
void main()
{
clrscr();

printf(“Name:abc\nAdress:bcv”);
getch();
}

//w.a.p to take a number and check the number is two digit or not.

#include
#include
void main()
{
int num;
clrscr();
printf(“Enter 1st number:”);
scanf(“%d”,&num);

if ((num>9)&&(num {
printf(“%d is two digit”,num);
}
else
{
printf(“%d is not two digit”,num);
}
getch();
}

Leave a Reply 72 views, 3 so far today |

Most Commented Posts

Leave a Reply

CAPTCHA Image
Refresh Image
*