Vaish College of Engineering
Vaish College of Engineering
PRACTICAL - FILE
Name: Section: A
Roll No: Subject: C-Programming
certificate
Signature:
ACKNOWLEDGEMENT
c-programming teacher “mr.pooja” for their able guidance and support in completing my project
which helped me in doing a lot of research and I came to know about so many new things.
I am thankful to them. Secondarily I would like to thank my parents who helped me in making
me in making this project within a limited period.
Date:
Aniket
#include <stdio.h>
int main() {
int number;
if (number > 8) {
printf("Number is greater than 8.\n");
} else {
Printf(“number is greater than 8.\n”);
}
getch();
}
#include <stdio.h>
int main() {
char ch;
printf("Enter a character: ");
scanf("%c", &ch);
if (ch == 'a') {
printf("Vowel\n");
} else if (ch == 'e') {
printf("Vowel\n");
} else if (ch == 'i') {
printf("Vowel\n");
} else if (ch == 'o') {
printf("Vowel\n");
} else if (ch == 'u') {
printf("Vowel\n");
} else {
printf("Not a vowel\n");
}
getch();
}
Output display:- program to check character is vowel or
not using else if ladder.
Program 4:-W.A.P to find greater between 3 no using
nested if.
#include <stdio.h>
int main() {
int num1, num2, num3;
getch();
}
Output display:- program to check greater between 3.no
using nested if
Program 5.:-W.A.P using while loop to display even no.
b/w 1 to 50.
#include <stdio.h>
int main() {
int num = 2;
getch();
}
Output display:- program to display even no.b/w 1 to 50
using while loop.
Program 6:- W.A.P. using do while loop to display counting 1 to
50.
#include <stdio.h>
int main() {
int num = 1;
do {
printf("%d\n", num);
num++;
} while (num <= 50);
getch();
}
output display:-program to print counting 1 to 50 using
do while loop.
int main() {
int number, i;
getch();
}
output Screen:-program to display table
of any number using for loop.
Program 8.
#include <stdio.h>
void main()
{
int day;
scanf("%d", &day);
switch (day) {
case 1:
printf("Sunday\n");
break;
case 2:
printf("Monday\n");
break;
case 3:
printf("Tuesday\n");
break;
case 4:
printf("Wednesday\n");
break;
case 5:
printf("Thursday\n");
break;
case 6:
printf("Friday\n");
break;
case 7:
printf("Saturday\n");
break;
default:
printf("Invalid day number\n");
getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
int a;
printf("enter the value of a");
scanf("%d",&a);
if (a>0)
{
printf("Number is Positive");
}
else
{
printf("Number is Negative");
getch();
#include <stdio.h>
void main() {
int n, first = 0, second = 1, next, i;
getch();
}
#include <stdio.h>
int main() {
int rows, i, j;
#include <stdio.h>
void main()
int a[5],i,item;
printf("enter 5 elements");
for(i=0;i<5;i++)
scanf("%d",&a[i]);
for(i=0;i<5;i++)
printf("\n%d",a[i]);
scanf("%d",&item);
for(i=0;i<5;i++)
if(item==a[i])
getch();
}
Output Screen:- program to find location of an element in an
array.
Program 13.:- call by value program
#include <stdio.h>
#include<conio.h>
// Function prototype
void swap(int a, int b);
int main() {
int x = 20, y = 30;
return 0;
}
// Function definition
void swap(int a, int b) {
int temp;
temp = a;
a = b;
b = temp;
#include <stdio.h>
int main() {
int x = 20, y = 30;
#include <stdio.h>
#include<conio.h>
int main() {
int num1, num2, sum;
int *ptr1, *ptr2;
ptr1 = &num1;
ptr2 = &num2;
return 0;
}
Output Screen:- program of sum using pointer.