0% found this document useful (0 votes)
6 views17 pages

Saish All Program

C basic programs

Uploaded by

saishgandhi9890
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views17 pages

Saish All Program

C basic programs

Uploaded by

saishgandhi9890
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

Program of swap the number

#include<stdio.h>
int main()
{
int a;
int b;
int c;
printf("enter value of a=");
scanf("%d",&a);
printf("enter value of b=");
scanf("%d",&b);
c=a;
a=b;
b=c;
printf("value fo a =%d",a);
printf(".");
printf("value fo b =%d",b);
}
Program of positive or negative numbers
#include <stdio.h>
int main()
{
int a;
int b;
printf("enter the value=");
scanf("%d",&a);
if(a>0)
{
printf("number is positive");
}
else
{
printf("number is negative");
}

}
Program of votting
#include <stdio.h>
int main()
{
int age;
printf("Enter your age=");
scanf("%d",&age);
if (age>=18)
{
printf("you can vote");
}
else
{
printf("you are small");
}
}
Program of adding 3 numbers
#include <stdio.h>
int main ()
{
int a;
int b;
int c;
int ave;
printf ("enter the value of a=\n");
scanf ("%d",&a);
printf ("enter the value of b=\n");
scanf ("%d",&b);
printf ("enter the value of c=\n");
scanf ("%d",&c);
ave=a+b+c;
printf ("sum=%d",ave);
return 0;
}
#include <stdio.h>
int main()
{
int a;
float b;
char c;
a=3;
b=4.5;
c=s;
printf("\n3");
printf("\n4.5");
printf("\ns");
}
Program of area of rectangle
#include<stdio.h>
int main()
{
int a;
int b;
int s;
printf("Enter breath of a= \n");
scanf("%d",&a);
printf("Enter width of b= \n");
scanf("%d",&b);
s=a*b;
printf("area of rectangle= %d",s);
return 0;
}
Program of giving grade
#include <stdio.h>
int main()
{
int a;
int b;
int c;
int d;
printf("enter the value=");
scanf("%d",&a);
if(a>75)
{
printf("A grade");
}
else
if(a>55)
{
printf("B grade");
}
else
if(a>25)
{
printf("C grade");
}
}
Program of multiplication
#include <stdio.h>
int main()
{
int a;
int b;
int c;
printf("enter value of a=");
scanf("%d",&a);
printf("enter value of b=");
scanf("%d",&b);
c=a*b;
printf("mul=%d",c);
}
Program of odd or even
#include <stdio.h>
int main()
{
int a;
int b;
printf("enter the value=");
scanf("%d",&a);
if(a%2==0)
{
printf("even");
}
else
{
printf("odd");
}
}
Program of add
#include <stdio.h>
int main()
{
int a;
int b;
int s;
printf("Enter value of a= \n");
scanf("%d",&a);
printf("Enter value of b= \n");
scanf("%d",&b);
s= a*b;
printf("Add= %d",s);
return 0;
}
Program of ave
#include <stdio.h>
int main ()
{
int a;
int b;
int c;
int ave;
printf ("enter the value of a=\n");
scanf ("%d",&a);
printf ("enter the value of b=\n");
scanf ("%d",&b);
printf ("enter the value of c=\n");
scanf ("%d",&c);
ave=a+b+c;
printf ("sum=%d",ave);
return 0;
}
Program of div
#include<stdio.h>
int main()
{
int a;
int b;
int s;
printf("Enter value of a= \n");
scanf("%d",&a);
printf("Enter valye of b= \n");
scanf("%d",&b);
s=a/b;
printf("DIV= %d",s);
return 0;
}
Program of sub
#include<stdio.h>
int main()
{
int a;
int b;
int s;
printf("Enter value of a= \n");
scanf("%d",&a);
printf("Enter valye of b= \n");
scanf("%d",&b);
s=a-b;
printf("sub= %d",s);
return 0;
}
Program of value 2
# include <stdio.h>
void main()
{
int x;
printf ("enter the number\n");
scanf("%d",&x);
x=x+2;
printf("value of x=%d",x);
}
Program of vovels
#include <stdio.h>
int main()
{
char ch;
printf("enter the letter =");
scanf("%c",&ch);
if(ch=='a'|| ch=='A' ||ch=='e' ||ch=='E' ||ch=='i' ||ch=='I' ||ch=='o'
||ch=='O' ||ch=='u' ||ch=='U')
{
printf("character %c is vowle",ch);
}
else
{
printf("character %c is not vowle",ch);
}
}
Program of printing word
#include <stdio.h>
void main()
{
printf ("hello friend");
printf (" hi saish");
}

Program of printing word


#include <stdio.h>
void main()
{
printf("hello world");
}

You might also like