Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 4

These Programs have been done in the lab:

**Program to input three numbers. Find their sum and Product


**Program For Swapping of two variables
** To Check If Input Year Is Leap Year Or Not (using If else)
*Program To Check If The Number Input By User Is Even Or Odd
*Program to convert lower case character into upper case character
*Program to convert lower case character into upper case character2
*Program to convert lower case character into upper case character3
*To Use Pre Increment and Decrement Operators
*To Use Post Increment and Decrement Operators
**Program To Find The Greatest Of The Three Numbers (using IF Else and Nested IF)
*Program to get a formatted pattern
**Program to print formatted output
**To Find If The Number Is Prime Or Not
**To Find The Factorial Of A Natural Numbers Using For Loop
*To Find The Factorial Of A Natural Numbers Using While
*To Find The Sum Of N Natural Numbers Using do while
*To Find The Sum Of N Natural Numbers Using for For Loop
*To Find The Sum Of N Natural Numbers using while
*To Print 5 Numbers Using Switch
**To Find Geometric Sum of series
1. To Print A Pattern Of Asterisks
2. To Print A Pattern Of Numbers
***To Print The FIBONACCI series up to n terms
*To Print The Number Of Days In A Particular Month using Switch
*Program to make Calculator using switch Case
3. To Print The Square, Cube & Fourth Power Of An Integer

**To Print The Table Of A Number using For Loop


****To Swap Two Numbers Using Functions By Reference
4. **To Swap Two Numbers Using Functions
**Find the largest of the three numbers using functions

**(*Program of an array to accept a list of numbers into 1-D array, find their sum, average and
display them.

To search for a number in a list of numbers using linear search .

***To sort a list of numbers using bubbl


// WAP TO CHECK WHETHER A NUMBER IS PRIME OR NOT

#include<stdio.h>
#include<conio.h>

void main()
{
int n,i,p;
p=0;
clrscr();

printf("enter the number \n");


scanf("%d",&n);

for(i=2;i<n/2;i++)
{if(n%i==0)
p++;
}

if(p==0)
printf("%d is prime ",n);

else if(p!=0)
printf("%d is not prime ",n);
getch();
}
// Created on: 6th Apr'11
// Objective: To Print A Pattern Of Asterisks '*'
/* Comment: In this program we use 'for' to print
a 5 by 5 pattern of ASTERISK*/

#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,rows,cols;
clrscr();

printf("\t\t PROGRAM TO PRINT A PATTERN USING '*'");


printf("\n\nENTER THE NUMBER OF ROWS & COLUMNS:: ");
scanf("%d%d",&rows,&cols);
for(i=0;i<rows;i++)
{
printf("\n\t\t\t\t");
for(j=0;j<cols;j++)
{
printf("%c",'*');
}
}
getch();
}
// Author: SAgar bansal
// Created on: 6th Apr'11
// Objective: To Print A Pattern Of Numbers
/* Comment: In this program we use 'for' to print
a pattern of numbers as:
1
22
333
4444
55555 */

#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,rows;
clrscr();

printf("\t\t PROGRAM TO PRINT A PATTERN OF NUMBERS");


printf("\n\nENTER THE NUMBER OF ROWS:: ");
scanf("%d",&rows);
for(i=1;i<=rows;i++)
{
printf("\n\t\t\t");
for(j=1;j<=i;j++)
{
printf("%d",i);
}
}
getch();
}

You might also like