0% found this document useful (0 votes)
29 views15 pages

Practile

This practice file

Uploaded by

hetp836scribd
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)
29 views15 pages

Practile

This practice file

Uploaded by

hetp836scribd
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/ 15

Computer Programming Dakshit Jambukiya [ ]

Practile1.1

Aim: - Write a Program to print the hello world.

Program: -

#include<stdio.h>

int main()
{

printf(“Hello world!.....”);

printf(“Kem cho”);

reture 0;

Output: -

CSE b-1[AIIE] 1
Computer Programming Dakshit jambukiya [ ]
Practile1.2

Aim: Write a program to check data-types and print its values

Program:

#include <stdio.h>

int main()

int a=32;

float f = 45.234;

double d = 198.345;

char e= 'x';

printf("Integer A= %d\n" , a);

printf("Float F= %.2f\n" , f);

printf("Double D= %.4lf\n" , d);

printf("\nSingle Char= %c" , e);

return 0;

Output: -

CSE b-1[AIIE] 2
Computer Programming Dakshit jambukiya [ ]
Practile1.3

Aim: Write a program to check ASCII values of characters.

Program:

#include<stdio.h>

int main()

int a=65;

char b='a';

printf("character of 65= %c\n",a);

printf("Number of (ASCII value) a= %d", b);

return 0;

Output: -

CSE b-1[AIIE] 3
Computer Programming Dakshit jambukiya [ ]
Practile1.4

Aim: Write a program for swapping of two numbers with three variables.

Program:

#include<stdio.h>

int main()

int a= 34;

int b= 45;

int c;

printf("Before swap");

printf("A= %d B= %d\n", a,b);

c=a;

a=b;

b=c;

printf("\nAfter swap");

printf("A= %d B= %d\n", a,b);

return 0;

CSE b-1[AIIE] 4
Computer Programming Dakshit jambukiya [ ]
Practile1.4

Output: -

Algorithm: -

1. Start the Program.


2. Initialize the value of ‘a’ and ‘b’.
3. Print the values.
4. By using variable ‘c’, manipulate the values of ‘a’ and ‘b’ such that it get swap.
5. Print the New swapped Values of ‘a’ and ‘b’.
6. End the program.

CSE b-1[AIIE] 5
Computer Programming Dakshit jambukiya [ ]
Practile1.4

Flowchart: -

Start

Input

A=34, B= 45

Declare C

C=A

A=B

B=C

Output

A= 45, B= 34

End

CSE b-1[AIIE] 6
Computer Programming Dakshit jambukiya [ ]
Practile1.5

Aim: - Write a program to find the Arithmetic Operators.

Program: -

#include<stdio.h>

int main ()

int x,y,add,sub,mul;

float div;

printf("Enter x value =");

scanf("%d", &x);

printf("Enter y value = ");

scanf("%d", &y);

add= x+y;

sub= x-y;

mul= x*y;

div= x/y;

printf("Addition= %d", add);

printf("\nSubstraction= %d", sub);

printf("\nMultiplication= %d", mul);

printf("\nDivision= %.2f", div);

return 0;

CSE b-1[AIIE] 9
Computer Programming Dakshit jambukiya [ ]
Practile1.5

Output: -

Algorithm: -

1. Start the Program.


2. Declare the variable.
3. Print the ‘x’ and ‘y’ values bye the user.
4. Using arithmetic operator, formulate the Addition, Subtraction, Multiplication
and Division.
5. Print the Answer.
6. End the program.

CSE b-1[AIIE] 9
Computer Programming Dakshit jambukiya [ ]
Practile1.5

Flowchart: -

Start

Input

x,y,add,mul,
sub,div.

Print value of
x and y.

add= x+y

sub= x-y

mul= x*y

div= x/y

Print the value of Addition,


Subtraction, Multiplication,
Division.

End

CSE b-1[AIIE] 9
Computer Programming Dakshit Jambukiya [ ]
Practile1.6

Aim: - Write a program to find the Simple interest.

Program: -

#include<stdio.h>

int main()

int P,R,N,SP;

printf("enter P value=");

scanf("%d", &P);

printf("enter R value=");

scanf("%d", &R);

printf("enter N value=");

scanf("%d", &N);

SP= P*R*N/100;

printf("Simple interest= %d", SP);

return 0;

CSE b-1[AIIE] 12
Computer Programming Dakshit Jambukiya [ ]
Practile1.6
Output: -

Algorithm: -

1. Start the program.


2. Declare the Variable ‘P’, ‘R’, ‘N’ and ‘SP’.
3. Print the values.
4. Apply the formula for simple interest.
5. Print Value of simple interest.
6. End the program.

CSE b-1[AIIE] 12
Computer Programming Dakshit Jambukiya [ ]
Practile1.6
Flowchart: -

Start

Input

P,R,N,SP

SP= P*R*N/100

Simple interest is
calculated.

Output

Simple Interest
value is
displayed.

End

CSE b-1[AIIE] 12
Computer Programming Dakshit Jambukiya [ ]
Practile1.7

Aim: - Write a program for swapping of two numbers with two variables.

Program: -

#include<stdio.h>

int main()

int a,b;

printf("Enter a value = ");

scanf("%d", &a);

printf("Enter b value = ");

scanf("%d", &b);

printf("Before swap\n");

printf("a= %d b= %d", a,b);

a= a+b;

b= a-b;

a= a-b;

printf("\nAfter swap");

printf("\na= %d b= %d", a,b);

return 0;

CSE b-1[AIIE] 15
Computer Programming Dakshit Jambukiya [ ]
Practile1.7

Output: -

Algorithm: -

1. Start the program.


2. Declare the variable ‘a’ and ‘b’.
3. Print it values.
4. By Arithmetic Operator, Manipulate the values of ‘a’ and ‘b’ such that it get
swap.
5. Print the swap values of ‘a’ and ‘b’.
6. End the program.

CSE b-1[AIIE] 15
Computer Programming Dakshit Jambukiya [ ]
Practile1.7

Flowchart: -

Start

Input

a= 34, b= 56

a= a+b

b= a-b

a= a-b

Output

a= 56, b= 34

End

CSE b-1[AIIE] 15

You might also like