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

C-Programming-Fundamentals-A-Beginners-Guide ppt

This document serves as an introductory guide to C programming, covering essential concepts and practical examples. It includes sample code for calculating the volume of a cone and finding the smaller of two numbers, as well as an expression evaluation involving variable manipulation. The author confirms that the content is original and properly acknowledges any external figures used.

Uploaded by

samewo7740
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

C-Programming-Fundamentals-A-Beginners-Guide ppt

This document serves as an introductory guide to C programming, covering essential concepts and practical examples. It includes sample code for calculating the volume of a cone and finding the smaller of two numbers, as well as an expression evaluation involving variable manipulation. The author confirms that the content is original and properly acknowledges any external figures used.

Uploaded by

samewo7740
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 9

MUDIT VERMA

33200124008

2025

COMPUTER SCIENCE AND ENGINEERING

BASIC PROGRAMING
C Programming
Fundamentals: A
Beginner's Guide
Welcome to this introductory guide on C programming. This
presentation will cover essential concepts and practical examples
that will help you get started with C.
"Q.Wap to accept radius and height of a cone and find its volume.

INPUT:

#include <stdio.h>
int main() {
// Declare variables for radius, height, and volume
float radius, height, volume;
const float PI = 3.14159;
// Prompt the user to enter the radius and height
printf("Enter the radius of the cone: ");
scanf("%f", &radius);
printf("Enter the height of the cone: ");
scanf("%f", &height);
// Calculate the volume of the cone
volume = (1.0 / 3.0) * PI * radius * radius * height;
// Display the result
printf("The volume of the cone is: %.2f\n", volume);
return 0;
}
OUTPUT:
Q.Wap to accept two number from the user and find the smaller number.

INPUT:

#include <stdio.h>
int main() {
// Declare variables to store the two numbers
int num1, num2, smaller;
// Prompt the user to enter the first number
printf("Enter the first number: ");
scanf("%d", &num1);
// Prompt the user to enter the second number
printf("Enter the second number: ");
scanf("%d", &num2);
// Use the ternary operator to find the smaller number
smaller = (num1 < num2) ? num1 : num2;
// Display the result
printf("The smaller number is: %d\n", smaller);
return 0;
}
OUTPUT:
Q.find out the value of x and y. z=--y+y+++--y+++y+y--; where y=5

INPUT:

#include <stdio.h>
int main() {
int y = 5;
int z = --y + y++ + --y + ++y + y--;
printf("y = %d\n", y);
printf("z = %d\n", z);
return 0;
}
Declaratio
n

I have not copied the contents of slide from external sources. Figures used from external sources have been
acknowledged properly. Thank you.

You might also like