Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
20 views8 pages

Assignment Colab 1 New

The document outlines a series of C programming experiments focused on input/output operations, arithmetic calculations, and financial computations. Each experiment includes an aim, theory, algorithm, flowchart, code pattern, conclusion, and general outcomes. Key topics covered include using scanf() and printf() for data handling, performing arithmetic operations, and calculating simple interest.

Uploaded by

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

Assignment Colab 1 New

The document outlines a series of C programming experiments focused on input/output operations, arithmetic calculations, and financial computations. Each experiment includes an aim, theory, algorithm, flowchart, code pattern, conclusion, and general outcomes. Key topics covered include using scanf() and printf() for data handling, performing arithmetic operations, and calculating simple interest.

Uploaded by

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

EXPERIMENT NO -1

AIM: Write a program in C to understand the input and output process.

Theory
Input and output operations in C are handled using scanf() for input and printf() for output. The %d
format specifier is used for integers.

Algorithm
1. Start
2. Declare an integer variable age.
3. Use printf() to prompt the user for input.
4. Use scanf() to read the input.
5. Use printf() to display the inputted value.
6. End

Flowchart
(Start) → [Input age] → [Output age] → (End)

PATTERN:

#include <stdio.h>

int main() {

int age;

//input process

printf("Enter your age: ");

scanf("%d",&age);

//output process

printf("Age: %d",age);

return 0;

}
EXPERIMENT NO -1


Conclusion

The program successfully demonstrates how to take input and display output using scanf() and
printf().

General Outcomes
o Understanding basic input/output operations in C.
 Using format specifiers for integers.
EXPERIMENT NO -1
AIM: Write a program to print an integer and a float no.

Theory
This program takes an integer and a floating-point number as input and displays them using printf(). The
%d format specifier is used for integers, and %.2f is used to display floats with two decimal places.

Algorithm
1. Start
2. Declare an integer num1 and a float num2.
3. Take input for both variables.
4. Display both values.
5. End

Flowchart
(Start) → [Input integer and float] → [Output integer and float] → (End)

PATTERN:

#include <stdio.h>

int main() {

int num1;

float num2;

printf("Enter an integer: ");

scanf("%d", &num1);

printf include ("Enter a float: ");

scanf("%f", &num2);

printf("Integer: %d\n", num1);

printf("Float: %.2f\n", num2);

return 0;

}
EXPERIMENT NO -1

Conclusion
This program correctly demonstrates how to handle different data types using input and output functions.

General Outcomes
 Learning to handle multiple data types in C.
 Using format specifiers effectively.
EXPERIMENT NO -1
Aim: Write a program to find the sum ,difference , multiplication ,division and average of two numbers

Theory
Basic arithmetic operations in C include addition (+), subtraction (-), multiplication (*), division (/), and
modulus (%).

Algorithm
1. Start
2. Take input for two numbers a and b.
3. Compute sum, difference, product, quotient, remainder, and average.
4. Display the results.
5. End

Flowchart
(Start) → [Input numbers] → [Perform operations] → [Output results] → (End)

Pattern:

#include <stdio.h>

int main(){

int a,b,sum,difference,multiplication,division,average;

printf("Enter first number:");

scanf("%d" , &a);

printf("Enter second number:");

scanf("%d" , &b);

//sum

sum =a+b;

printf("The sum of two numbers is :%d\n" , sum);

//difference

difference= a-b;

printf("The difference of two numbers is :%d\n", difference);

//multiplication

multiplication =a*b;

printf("The multiplication of two numbers is :%d\n",multiplication );

//division
EXPERIMENT NO -1
division =a/b;

printf("The quotient of two numbers is :%d\n", division);

division=a%b;

printf("The remainder of two numbers is :%d\n", division);

//average

average = (a+b)/2;

printf("the average of two numbers is :%d\n", average );

return 0;

Conclusion
This program successfully performs arithmetic operations on two numbers and displays the results.

General Outcomes
EXPERIMENT NO -1
 Understanding arithmetic operators in C.
 Learning precedence of operations.

AIM:Write a program to find the simple Interest.

Theory
Simple Interest is calculated using the formula: where P is the principal amount, R is the rate of interest, and
T is the time period.

Algorithm
1. Start
2. Take input for principal, rate, and time.
3. Compute simple interest using the formula.
4. Display the result.
5. End

Flowchart
(Start) → [Input P, R, T] → [Compute SI] → [Output SI] → (End)

Pattern :
#include<stdio.h>
int main(){
float principal, rate ,time ,simple_interest;
printf("Enter the principal amount: ");
scanf("%f",&principal);

printf( "Enter rate of interest:");


scanf("%f",&rate);

printf("Enter the time in years:" );


scanf("%f",&time);
simple_interest= principal*rate*time/100;
printf("simple interest is :%f", simple_interest);
return 0;
EXPERIMENT NO -1
}

Conclusion
This program efficiently calculates simple interest using user input values.

General Outcomes
 Understanding financial calculations in C.
 Learning to use float data types for precision.

You might also like