0% found this document useful (0 votes)
41 views

Programming Report Daniel

This document contains 4 tasks that demonstrate calculating sums and averages in C programming using pseudocode and flowcharts. Each task includes the pseudocode, flowchart, C code, and output for programs that: 1) Calculate the sum of two numbers. 2) Calculate the sum and average of 4 numbers. 3) Check if a number is even or odd. 4) Convert between Fahrenheit and Celsius temperatures.

Uploaded by

Firdaus 47
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)
41 views

Programming Report Daniel

This document contains 4 tasks that demonstrate calculating sums and averages in C programming using pseudocode and flowcharts. Each task includes the pseudocode, flowchart, C code, and output for programs that: 1) Calculate the sum of two numbers. 2) Calculate the sum and average of 4 numbers. 3) Check if a number is even or odd. 4) Convert between Fahrenheit and Celsius temperatures.

Uploaded by

Firdaus 47
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/ 12

TASK 1

PSEUDO CODE FLOWCHART

1. BEGIN BEGIN

2. INPUT A,B
3. CALC SUM=A+B
4. PRINT RESULT
READ INPUT A,B
5. END

SUM=A+B

PRINT RESULT

END
CPROGRAMMING

/*c program to calculate sum of numbers*/


#include <stdio.h>
int main()
{
int a,b,sum;
printf("Enter the first number:");
scanf("%d",&a);
printf("Enter the second number:");
scanf("%d",&b);
sum=a+b;
printf("\nSum of %d and %d is = %d",a,b,sum);
return 0;
}
OUTPUT
TASK 4

PSEUDO CODE FLOWCHART

1.BEGIN
2.INPUT TEMPERATURE IN FAHRENHEIT
BEGIN
3.CALC CELCIUS = (FAHRENHEIT-32)*5/9
4.PRINTF
INPUT TEMPERATURE
5.INPUT TEMPERATURE IN CELCIUS
IN FAHRENHEIT
6.CALC FAHRENHEIT = (CELCIUS*9/5)+32
7.PRINTF
8.END
CACL CELCIUS = (FAHRENHEIT-32)*5/9

PRINTF

INPUT TEMPERATURE
IN CELCIUS

CACL FAHRENHEIT=(CELCIUS*9/5)+32

PRINTF

END
CPROGRAMMING
/*c program to convert Fahrenheit to Celcius and Celcius to Fahrenheit*/
#include <stdio.h>
int main ()
{
float celcius,fahrenheit;

printf ("Please Enter the temperature in Fahrenheit:");


scanf ("%f",&fahrenheit);

//Convert the temperature from Fahrenheit to Celcius


celcius = (fahrenheit - 32)*5/9 ;
//celcius = 5 * (fahrenheit - 32) / 9;

//celcius = (fahrenheit - 32) * 0.55556;


printf("\n %.2f Fahrenheit = %.2f Celcius",fahrenheit,celcius);
printf ("Please Enter the temperature in Celcius:");
scanf ("%f",&celcius);
//Convert the temperature from Celcius to Fahrenheit
fahrenheit = (celcius*9/5)+32;
//fahrenheit = 32 + (celcius*9/5;
//fahrenheit = (celcius*1.8) + 32
printf("\n %.2f Celcius = %.2f Fahrenheit",celcius,fahrenheit);
scanf ("%f.&fahrenheit");

return 0;
}
OUTPUT
TASK 3

PSEUDO CODE FLOWCHART

1.BEGIN BEGIN

2.READ INPUT
3.IF NUMBER IS DIVISBLE BY 2
READ INTEGER
4.PRINT “EVEN NUMBER”
5.ELSE
6.PRINT “ODD NUMBER”
IF NUMBER
7.END IS DIVISBLE
BY 2=0

PRINT”ODD PRINT “EVEN


NUMBER” NUMBER”

END
CPROGRAMMING
/*c program to check whether number is EVEN or ODD*/
#include <stdio.h>
int main ()
{
int num;
printf("Enter an integer number:");
scanf("%d",&num);
/*If number is divisible by 2 then number is EVEN otherwise is ODD*/
if (num%2==0)
printf("%d is an EVEN number.",num);
else
printf("%d is an ODD number.",num);
return 0;
}
OUTPUt
TASK 2

PSEUDO CODE FLOWCHART

BEGIN
1.BEGIN
2.READ INPUT A,B,C,D
3.SUM=A+B+C+D
READ INPUT A,B,C,D
4.PRINTF
5.AVERAGE=SUM/4
6.PRINTF
SUM=A+B+C+D
7.END

PRINTF

AVRG=SUM/4

PRINTF

END
CPROGRAMMING

/* c program calculate sum and average of numbers*/


#include <stdio.h>
int main ()
{
int a,b,c,d,sum,average;
printf("Enter the first number:") ;
scanf("%d",&a) ;
printf("Enter the second number:") ;
scanf("%d",&b) ;
printf("Enter the third number:") ;
scanf("%d",&c) ;
printf("Enter the forth number:") ;
scanf("%d",&d) ;
sum=a+b+c+d;
printf("\nSum %d",sum) ;
average= sum/4 ;
printf("\naverage = %d\n",average) ;
return 0 ;
}
OUTPUT
PROGRAMMING LAB
REPORT

NAME : DANIAL ASYMAWI BIN ZOLKAPLI


MATRIX NO. : 172060152
GROUP : GROUP 1

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy