PRINT YOUR NAME
PROGRAM 1 DATE: 22.10.2024
AIM
Write a C program to print your name
ALGORITHM
STEP 1: START
STEP 2: PRINT “angel”
STEP 3: STOP
PROGRAM
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
printf("angel");
getch();
OUTPUT
RESULT
The program has been successfully executed and the
output is verified
PRINT YOUR ADDRESS
PROGRAM 2 DATE: 22.10.2024
AIM
Write a C program to print your address
ALGORITHM
STEP 1: START
STEP 2: PRINT “palliparambil (h), bhavana road, thomaspuram,maradu”
STEP 3: STOP
PROGRAM
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
printf("palliparambil(h),bhavanaroad,thomaspuram,mara
du");
getch();
}
OUTPUT
RESULT
The program has been successfully executed and the
output is verified
SUM OF 2 NUMBERS
PROGRAM 3 DATE: 22.10.2024
AIM
Write a C program to find the sum of 2 numbers
ALGORITHM
STEP 1: START
STEP 2: READ a=10 ,b=20
STEP 3: SUM = a+b
STEP 4: PRINT SUM
STEP 5: STOP
PROGRAM
#include<stdio.h>
#include<conio.h>
void main()
{
int a=10,b=20,sum;
sum=a+b;
clrscr();
printf("sum=%d",sum);
getch();
}
OUTPUT
RESULT
The program has been successfully executed and the
output is verified
AREA OF RECTANGLE
PROGRAM 4 DATE: 22.10.2024
AIM
Write a C program to find the area of rectangle
ALGORITHM
STEP 1: START
STEP 2: READ l=10 , b=5
STEP 3: AREA = l*b
STEP 4: PRINT AREA
STEP 5: STOP
PROGRAM
#include<stdio.h>
#include<conio.h>
void main()
{
int l=10,b=5,A;
A=l*b;
clrscr();
printf("area=%d",A);
getch();
}
OUTPUT
RESULT
The program has been successfully executed and the
output is verified
AREA OF SQUARE
PROGRAM 5 DATE: 22.10.2024
AIM
Write a C program to find the area of sqaure
ALGORITHM
STEP 1: START
STEP 2: READ a= 5
STEP 3: AREA = a*a
STEP 4: PRINT AREA
STEP 5: STOP
PROGRAM
#include<stdio.h>
#include<conio.h>
void main()
{
int a=5,A;
A=a*a;
clrscr();
printf("area=%d",A);
getch();
}
OUTPUT
RESULT
The program has been successfully executed and the
output is verified
POSITIVE OR NEGATIVE
NUMBER
PROGRAM 6 DATE: 25.10.2024
AIM
Write a C program to check whether a number is
positive or negative
ALGORITHM
STEP 1: START
STEP 2: READ A NUMBER a
STEP 3: if a>0 PRINT “POSITIVE NUMBER”
STEP 4: else PRINT “NEGATIVE NUMBER ”
STEP 5: STOP
PROGRAM
#include<stdio.h>
#include<conio.h>
void main()
{
int a;
clrscr();
printf("ENTER A NUMBER:");
scanf("%d",&a);
if(a>0)
{
printf("positive number");
}
else
{
printf("negative number");
}
getch();
OUTPUT
RESULT
The program has been successfully executed and the
output is verified
LARGEST OF TWO NUMBERS
PROGRAM 7 DATE: 25.10.2024
AIM
Write a C program to find largest of two numbers
ALOGRITHM
STEP 1: START
STEP 2: READ TWO NUMBERS a,b
STEP 3: if a>b PRINT a is Larger
STEP 4: else PRINT b is larger
STEP 5: STOP
PROGRAM
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf("ENTER FIRST NUMBER:");
scanf("%d",&a);
printf("ENTER SECOND NUMBER:");
scanf("%d",&b);
if(a>b)
{
printf("%d is larger ",a);
}
else
{
printf("%d is larger",b);
}
getch();
}
OUTPUT
RESULT
The program has been successfully executed and the
output is verified
ODD OR EVEN NUMBER
PROGRAM 8 DATE: 25.10.2024
AIM
Write a C program to check a number is odd or even
ALGORITHM
STEP 1: START
STEP 2: READ A NUMBER a
STEP 3: if a%2=0 THEN PRINT “EVEN NUMBER”
STEP 4: else PRINT “ODD NUMBER”
STEP 5: STOP
PROGRAM
#include<stdio.h>
#include<conio.h>
void main()
{
int a;
clrscr();
printf("ENTER A NUMBER");
scanf("%d",&a);
if(a%2==0)
{
printf("%d is a even no",a);
}
else
{
printf("%d is a odd no",a);
}
getch();
}
OUTPUT
RESULT
The program has been successfully executed and the
output is verified
GRADE OF MARKS
PROGRAM 9 DATE: 29.10.2024
AIM
Write a C program to print the grade of marks obtained
ALGORITHM
STEP 1: START
STEP 2: READ MARK a
STEP 3: if a>90 THEN PRINT “A+” GOTO STEP 12
STEP 4: if a>80 PRINT “A” GOTO STEP 12
STEP 5: if a>70 PRINT “B+” GOTO STEP 12
STEP 6: if a>60 PRINT “B” GOTO STEP 12
STEP 7: if a>50 PRINT “C+” GOTO STEP 12
STEP 8: if a>40 PRINT “C” GOTO STEP 12
STEP 9: if a>30 PRINT “D+” GOTO STEP 12
STEP 10: if a>20 PRINT “D” GOTO STEP 12
STEP 11: else PRINT “FAILED”
STEP 12: STOP
PROGRAM
#include<stdio.h>
#include<conio.h>
void main()
{
int a;
clrscr();
printf("ENTER YOUR SCORE:");
scanf("%d",& a);
if(a>90)
{
printf("A+");
}
else if(a>80)
{
printf("A");
}
else if(a>70)
{
printf("B+");
}
else if(a>60)
{
printf("B");
}
else if(a>50)
{
printf("C+");
}
else if(a>40)
{
printf("C");
}
else if(a>30)
{
printf("D+");
}
else if(a>20)
{
printf("D grade just pass");
}
else
{
printf("failed");
}
getch();
}
OUTPUT
RESULT
The program has been successfully executed and the
output is verified
NUMBER DIVISIBLE BY 5
PROGRAM 10 DATE: 29.10.2024
AIM
Write a C program to check whether a number is
divisible by 5
ALGORITHM
STEP 1: START
STEP 2: READ A NUMBER a
STEP 3: if a IS DIVISIBLE 5 THEN PRINT a IS DIVISIBLE BY 5
STEP 4: else PRINT a IS NOT DIVISIBLE BY 5
STEP 5: STOP
PROGRAM
#include<stdio.h>
#include<conio.h>
void main()
{
int a;
clrscr();
printf("ENTER A NUMBER:");
scanf("%d",&a);
if(a%5==0)
{
printf("%d is divisible by 5",a);
}
else
{
printf("%d is not divisible by 5",a);
}
getch();
}
OUTPUT
RESULT
The program has been successfully executed and the
output is verified
PRINT DAY OF WEEK USING
SWITCH STATEMENT
PROGRAM 11 DATE: 29.10.2024
AIM
Write a C program to display name of day based on
number between 1 to 7
ALGORITHM
STEP 1: START
STEP 2: READ a
STEP 3: if a IS 1 THEN PRINT “SUNDAY” GOTO STEP 11
STEP 4: if a IS 2 THEN PRINT “MONDAY” GOTO STEP 11
STEP 5: if a IS 3 THEN PRINT “TUESDAY” GOTO STEP 11
STEP 6: if a IS 4 THEN PRINT “WEDNESDAY” GOTO STEP 11
STEP 7: if a IS 5 THEN PRINT “THURSDAY” GOTO STEP 11
STEP 8: if a IS 6 THEN PRINT “FRIDAY” GOTO STEP 11
STEP 9: if a IS 7 THEN PRINT “SATURDAY” GOTO STEP 11
STEP 10: else PRINT “DEFAULT INPUT”
STEP 11: STOP
PROGRAM
#include<stdio.h>
#include<conio.h>
void main()
{
int a;
clrscr();
printf("ENTER A NO: BETWEEN 1 TO 7");
scanf("%d",&a);
switch(a)
{
case 1:printf("sunday");
break;
case 2:printf("monday");
break;
case 3:printf("tuesday");
break;
case 4:printf("wednesday");
break;
case 5:printf("thursday");
break;
case 6:printf("friday");
break;
case 7:printf("saturday");
break;
default:printf("enter a vaild no.");
}
getch();
}
OUTPUT
RESULT
The program has been successfully executed and the
output is verified
ARITHMETIC OPERATIONS
USING SWITCH STATEMENT
PROGRAM 12 DATE: 29.10.2024
AIM
Write a C program to perform all arithmetic operations
using switch statement
ALOGRITHM
STEP 1: START
STEP 2: READ THREE NUMBERS a,b,c
STEP 3: if a IS 1 THEN ADD b,c AND GOTO STEP 8
STEP 4: if a IS 2 THEN SUBSTRACT b,c AND GOTO STEP 8
STEP 5: if a IS 3 THEN MULTIPLY b,c AND GOTO STEP 8
STEP 6: if a IS 4 THEN DIVIDE b,c AND GOTO STEP 8
STEP 7: else PRINT “INVALID INPUT”
STEP 8: STOP
PROGRAM
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,choice;
clrscr();
printf("enter two numbers");
sc,anf("%d %d,",& a,& b);
printf("enter your choice:\n 1.addition \n
2.substraction \n 3.multiplication \n 4.division \
nplease enter your choice");
scanf("%d",& choice);
switch(choice)
{
case 1:{
int sum=a+b;
printf("Sum= %d",sum);
break;
}
case 2:{
int c=a-b;
printf("%d - %d =%d",a,b,c);
break;
}
case 3:{
int d=a*b;
printf("%d",d);
break;
}
case 4:{
int e=a/b;
printf("%d",e);
break;
}
default:printf("enter a valid choice");
}
getch();
OUTPUT
RESULT
The program has been successfully executed and the
output is verified
PRINT YOUR NAME 10 TIMES
PROGRAM 13 DATE: 29.10.2024
AIM
Write a C program to print your name 10 times using
while loop
ALGORITHM
STEP 1: START
STEP 2: READ i=1 PRINT “ANGEL”
STEP 3: if i<=10 THEN PRINT “angel” AND DO i++
STEP 4: STOP
PROGRAM
#include<stdio.h>
#include<conio.h>
void main()
{
int a=0,i=1;
clrscr();
while(a<10)
{
printf("\n angel");
a=a+i;
}
getch();
}
OUTPUT
RESULT
The program has been successfully executed and the
output is verified
PRINT 1 TO 10 USING
WHILE LOOP
PROGRAM 14 DATE: 29.10.2024
AIM
Write a C program to print 1 to 10 using while loop
ALGORITHM
STEP 1: START
STEP 2:
STEP 3:
STEP 4:
STEP 5:
STEP 6:
STEP 7:
STEP 8:
STEP 9:
STEP 10: STOP
PROGRAM
#include<stdio.h>
#include<conio.h>
void main()
{
int a=0;
clrscr();
printf("while loop");
while(a<10)
{
a=a+1;
printf("\n%d",a);
}
getch();
}
OUTPUT
RESULT
The program has been successfully executed and the
output is verified
PRINT WELCOME 10 TIMES
USING DO-WHILE
PROGRAM 15 DATE: 08.11.2024
AIM
Write a C program to print welcome 10 times using do
while loop
ALGORITHM
STEP 1: START
STEP 2:
STEP 3:
STEP 4:
STEP 5:
STEP 6:
STEP 7:
STEP 8:
STEP 9:
STEP 10: STOP
PROGRAM
#include<stdio.h>
#include<conio.h>
void main()
{
int i=1;
clrscr();
printf("do-while loop\n");
do
{
printf("\nWELCOME");
i++;
}while(i<=10);
getch();
}
OUTPUT
RESULT
The program has been successfully executed and the
output is verified
PRINT 1 TO 10 USING
DO-WHILE LOOP
PROGRAM 16 DATE: 08.11.2024
AIM
Write a C program to print 1 to 10 using do while loop
ALGORITHM
STEP 1: START
STEP 2:
STEP 3:
STEP 4:
STEP 5:
STEP 6:
STEP 7:
STEP 8:
STEP 9:
STEP 10: STOP
PROGRAM
#include<stdio.h>
#include<conio.h>
void main()
{
int a=1,i=1;
clrscr();
printf("do-while loop");
do
{
printf("\n%d",a);
a=a+i;
}while(a<=10);
getch();
}
OUTPUT
RESULT
The program has been successfully executed and the
output is verified
PRINT WELCOME 10 TIMES
USING FOR LOOP
PROGRAM 17 DATE: 08.11.2024
AIM
Write a C program to print welcome 10 times using for
loop
ALGORITHM
STEP 1: START
STEP 2:
STEP 3:
STEP 4:
STEP 5:
STEP 6:
STEP 7:
STEP 8:
STEP 9:
STEP 10: STOP
PROGRAM
#include<stdio.h>
#include<conio.h>
void main()
{
int i;
clrscr();
printf("forlooping\n");
for(i=1;i<=10;i++)
{
printf("\nwelcome");
}
getch();
}
OUTPUT
RESULT
The program has been successfully executed and the
output is verified
PRINT 1 TO 10 USING
FOR LOOP
PROGRAM 18 DATE: 08.11.2024
AIM
Write a C program to print 1 to 10 using for loop
ALGORITHM
STEP 1: START
STEP 2:
STEP 3:
STEP 4:
STEP 5:
STEP 6:
STEP 7:
STEP 8:
STEP 9:
STEP 10: STOP
PROGRAM
#include<stdio.h>
#include<conio.h>
void main()
{
int i;
clrscr();
printf("forloop\n");
for(i=1;i<=10;i++)
{
printf("\n%d",i);
}
getch();
}
OUTPUT
RESULT
The program has been successfully executed and the
output is verified
AREA OF SQUARE AND
RECTANGLE
(SWITCH STATEMENT)
PROGRAM 19 DATE: 11.11.2024
AIM
Write a C program to find area of square and rectangle
using switch statement
ALGORITHM
STEP 1: START
STEP 2:
STEP 3:
STEP 4:
STEP 5:
STEP 6:
STEP 7:
STEP 8:
STEP 9:
STEP 10: STOP
PROGRAM
#include<stdio.h>
#include<conio.h>
void main()
{
int a,l,b,choice;
clrscr();
printf("switch statement\n");
printf("\nEnter your choice \n1.Area of square \
n2.Area of rectangle");
scanf("%d",&choice);
switch(choice)
{
case 1:{ printf("\nEnter a number:");
scanf("%d",&a);
printf("Area=%d",a*a);
break;
}
case 2:{ printf("\nEnter two numbers:");
scanf("%d%d",&l,&b);
printf("Area=%d",l*b);
break;
}
default:printf("Enter a valid choice");
}
getch();
}
OUTPUT
RESULT
The program has been successfully executed and the
output is verified
SUM OF DIGITS OF A NUMBER
PROGRAM 20 DATE: 11.11.2024
AIM
Write a C program to find sum of digits of a number
using while loop
ALGORITHM
STEP 1: START
STEP 2:
STEP 3:
STEP 4:
STEP 5:
STEP 6:
STEP 7:
STEP 8:
STEP 9:
STEP 10: STOP
PROGRAM
#include<stdio.h>
#include<conio.h>
void main()
{
int a,i,sum=0;
clrscr();
printf("sum of digits using whileloop\n");
printf("enter a number: ");
scanf("%d" ,&a);
while(a>0)
{
i=a%10;
sum=sum+i;
a=a/10;
}
printf("SUM = %d",sum);
getch();
}
OUTPUT
RESULT
The program has been successfully executed and the
output is verified
ACCEPT AND PRINT YOUR
NAME
PROGRAM 21 DATE: 12.11.2024
AIM
Write a C program to accept and print your name
ALGORITHM
STEP 1: START
STEP 2:
STEP 3:
STEP 4:
STEP 5:
STEP 6:
STEP 7:
STEP 8:
STEP 9:
STEP 10: STOP
PROGRAM
#include<stdio.h>
#include<conio.h>
void main()
{
char a[20];
clrscr();
printf("enter your name:");
scanf("%s",a);
printf(“NAME:%s”,a);
getch();
}
OUTPUT
RESULT
The program has been successfully executed and the
output is verified
READ AND DISPLAY A
CHARACTER
PROGRAM 22 DATE: 12.11.2024
AIM
Write a C program to read and display a single
character
ALGORITHM
STEP 1: START
STEP 2:
STEP 3:
STEP 4:
STEP 5:
STEP 6:
STEP 7:
STEP 8:
STEP 9:
STEP 10: STOP
PROGRAM
#include<stdio.h>
#include<conio.h>
void main()
{
char a;
clrscr();
printf("enter a character:");
scanf("%c",&a);
printf("character:%c",a);
getch();
}
OUTPUT
RESULT
The program has been successfully executed and the
output is verified
REPORT CARD
PROGRAM 23 DATE: 12.11.2024
AIM
Write a C program to read students details
roll.no,name,course and marks of 5 subjects.Prepare a
students report card.
ALGORITHM
STEP 1: START
STEP 2: READ YOUR NAME,COURSE,ROLL.NO,MARKS
name,couse,roll.no,sub1,sub2,sub3,sub4,sub5,t,p
STEP 3: PRINT “REPORT CARD”
STEP 4: PRINT name,couse,roll.no,sub1,sub2,sub3,sub4,sub5,
STEP 5: TOTAL,t=sub1+,sub2+sub3+sub4+sub5
STEP 6: PRINT t
STEP 7: PERCENTAGE, p=t/5
STEP 8: PRINT p
STEP 9: STEP 3: if p>90 THEN PRINT “A” GOTO STEP 12
STEP 4: if a>80 PRINT “B” GOTO STEP 12
STEP 5: if a>70 PRINT “C” GOTO STEP 12
STEP 6: if a>60 PRINT “B” GOTO STEP 12
STEP 7: if a>50 PRINT “D” GOTO STEP 12
STEP 8: if a>40 PRINT “C” GOTO STEP 12
STEP 9: if a>30 PRINT “D+” GOTO STEP 12
STEP 10: if a>20 PRINT “D” GOTO STEP 12
STEP 11: else PRINT “FAILED”
STEP 10: STOP
PROGRAM
#include<stdio.h>
#include<conio.h>
void main()
{
char name[20],course[20];
int roll_no;
int P,t,sub1,sub2,sub3,sub4,sub5;
clrscr();
printf(" ENTER YOUR DETAILS");
printf("\n\nenter your name:");
scanf("%s",name);
printf("enter your roll.no:");
scanf("%d",&roll_no);
printf("enter your course:");
scanf("%s",course);
printf("\n\n ENTER YOUR MARK \n");
printf("\n Mark of ENGLISH:");
scanf("%d",&sub1);
printf(" Mark of CYBER:");
scanf("%d",&sub2);
printf(" Mark of C:");
scanf("%d",&sub3);
printf(" Mark of DIGITAL FUNTAMENTALS:");
scanf("%d",&sub4);
printf(" Mark of MATHS:");
scanf("%d",&sub5);
printf("\n\n REPORT CARD \n\n" );
printf("NAME:%s\nROLL.NO:%d\nCOURSE:%s\n\n
MARK OBTAINED\n\nENGLISH:%d\nCYBER:%d\nC:%d\nDIGITAL
FUNDAMENTALS:%d\nMATHS:
%d",name,roll_no,course,sub1,sub2,sub3,sub4,sub5);
t=sub1+sub2+sub3+sub4+sub5;
printf("\n\n\nTOTAL:%d",t);
P=t/5;
printf(" Percentage obtained=
%d",P);
if(P>=90)
{
printf("\nGRADE:A");
}
else if(P>=80)
{
printf("\nGRADE:B");
}
else if(P>=70)
{
printf("\nGRADE:C");
}
else if(P>=60)
{
printf("\nGRADE:D");
}
else if(P<35)
{
printf("\nFaIL");
}
else
{
printf("\nJUST PASS");
}
getch();
}
OUTPUT
RESULT
The program has been successfully executed and the
output is verified
READ & DISPLAY CHARACTER
UNFORMATTED I/O
PROGRAM 24 DATE: 12.11.2024
AIM
Write a C program to read a character and display it
ALGORITHM
STEP 1: START
STEP 2: READ A CHARACTER ,char
STEP 3: PRINT char
STEP 4: STOP
PROGRAM
#include<stdio.h>
#include<conio.h>
void main()
{
char a;
clrscr();
printf(" UNFORMATTED I/O
FUNCTIONS\n\n");
printf("enter a character:");
a=getchar();
printf("character:");
putchar(a);
getch();
}
OUTPUT
RESULT
The program has been successfully executed and the
output is verified
READ AND DISPLAY NAME
PROGRAM 25 DATE: 12.11.2024
AIM
Write a C program to read your name and display
ALGORITHM
STEP 1: START
STEP 2: READ YOUR NAME, name
STEP 3: PRINT name
STEP 4: STOP
PROGRAM
#include<stdio.h>
#include<conio.h>
void main()
{
char a[20];
clrscr();
printf(" Unformatted i/o functions\n\
n");
printf("enter name:");
gets(a);
printf("NAME:");
puts(a);
getch();
}
OUTPUT
RESULT
The program has been successfully executed and the
output is verified
MULTIPLICATION TABLE
PROGRAM 26 DATE: 12.11.2024
AIM
Write a C program to print multiplication table of a
number using for loop
ALGORITHM
STEP 1: START
STEP 2: READ a,b,i=1
STEP 3: b= a*i
STEP 4: print b
STEP 5: i++
STEP 6: if i<=10
STEP 7: STOP
PROGRAM
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,i;
clrscr();
printf(" MULTIPLICATION TABLE\n\n");
printf("Enter a number:");
scanf("%d",&a);
for(i=1;i<=10;i++)
{
b=a*i;
printf("\n%d*%d=%d",a,i,b);
}
getch();
}
OUTPUT
RESULT
The program has been successfully executed and the
output is verified
FACTORIAL OF A NUMBER
PROGRAM 27 DATE: 12.11.2024
AIM
Write a C program to find factorial of a number using
for loop
ALGORITHM
STEP 1: START
STEP 2: READ i =1,n,fact =1
STEP 3: fact=fact*i
STEP 4: i++
STEP 5: if i<=n THEN GOTO STEP 3
STEP 6: PRINT fact
STEP 7: STOP
PROGRAM
#include<stdio.h>
#include<conio.h>
void main()
{
int i,n,fact=1;
clrscr();
printf("enter a number:");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
fact=fact*i;
}
printf("Factorial=%d",fact);
getch();
}
OUTPUT
RESULT
The program has been successfully executed and the
output is verified
FACTORS OF A NUMBER
PROGRAM 28 DATE: 12.11.2024
AIM
Write a C program to print factors of a number using for
loop
ALGORITHM
STEP 1: START
STEP 2: READ n,i=1
STEP 3: if n%i==0
STEP 4: PRINT i
STEP 5: i++
STEP 6: if i<=n THEN GOTO STEP 3
STEP 7: STOP
PROGRAM
#include<stdio.h>
#include<conio.h>
void main()
{
int n,i;
clrscr();
printf("enter a number:");
scanf("%d",&n);
printf("factors of %d:",n);
for(i=1;i<=n;i++)
{
if(n%i==0)
printf(" %d ",i);
}
getch();
}
OUTPUT
RESULT
The program has been successfully executed and the
output is verified