Posts

Showing posts from April, 2017

C program to check whether a person is eligible for voting or not...!!

#include<stdio.h>
#include<conio.h>
void main()
{
int age;
clrscr();
printf("enter your age to check you are elizable for voting or not=");
scanf("%d",&age);
if(age>18)
{
printf("%d you are elizable", age);
}
else
{
printf("you are not elizable for vote",age);
}
getch();
}


program to find even or odd number

#include<stdio.h>
#include<conio.h>
void main()
{
int a;
printf("Enter a value which you want to check=");
scanf("%d",&a);
if(a%2==0)
{
printf("a is even");
}
else
{
printf("a is odd");
}
getch();
}

program to find character's ASCII values

#include<stdio.h>
#include<conio.h>
void main()
{
char a;
printf("enter a character=");
scanf("%c",&a);
printf("a=%d",a);
getch();
}

simple Interest program in C language

#include<stdio.h>
#include<conio.h>
void main()
{
int p,t,r,i;
clrscr();
printf("enter the value for p=");
scanf("%d",&p);
printf("enter the value for t=");
scanf("%d",&t);
printf("enter the value for r=");
scanf("%d",&r);
i=p*t*r/100;
printf("interest is==%f", i);
getch();
}

what is printf() and scanf() in Clanguage

what is printf() and scanf () roll in C language  ?
printf() and scanf() functions are inbuilt library functions in C programming language which are available in C library by default. These functions are declared and related macros are defined in “stdio.h” which is a header file in C language.We have to include “stdio.h” file as shown in below C program to make use of these printf() and scanf() library functions in C language.printf() and scanf() are basic function of C language.

Add two number in c language

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,sum=0;
clrscr();
printf("enter a value for a=");
scanf("%d",&a);
printf("enter value for b=");
scanf("%d",&b);
sum=a+b;
printf("%d",sum);
getch();
}

simple program to print hello in C language

#include<stdio.h>
#include<conio.h>
void main()
{
printf("Hello....its our first program...!!!");

getch();
}