Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Class notes

Class notes ESC104 (Esc104)

Rating
-
Sold
-
Pages
217
Uploaded on
20-01-2025
Written in
2024/2025

It is one of the most popular programming languages in the world If you know C, you will have no problem learning other popular programming languages such as Java, Python, C++, C#, etc, as the syntax is similar C is very fast, compared to other programming languages, like Java and Python C is very versatile; it can be used in both applications and technologie

Show more Read less
Institution
Course

Content preview

ALI YASIR (BIT 2)


www.oumstudents.tk




EXAMPLE C PROGRAMMING CODES

,Program

main( )
{
/*…………printing begins………………*/

printf(“I see, I remember”);

/*………………printing ends…………………*/
}

Fig 1.2 A program to print one line of text




Addition of Two Numbers
Program

/* Programm ADDITION line-1 */
/* Written by EBG line-2 */
main() /* line-3 */
{ /* line-4 */
int number; /* line-5 */
float amount; /* line-6 */
/* line-7 */
number = 100; /* line-8 */
/* line-9 */
amount = 30.75 + 75.35; /* line-10 */
printf(“%d\n”,number); /* line-11 */
printf(“%5.2f”,amount); /* line-12 */
} /* line-13 */


Fig.1.4 Program to add two numbers


Program
/*--------------------- INVESTMENT PROBLEM --------------------*/
#define PERIOD 10
#define PRINCIPAL 5000.00
/*-------------------- MAIN PROGRAM BEGINS --------------------*/
main()
{ /*------------------- DECLARATION STATEMENTS ----------------*/
int year;
float amount, value, inrate;
/*------------------- ASSIGNMENT STATEMENTS -------------------*/
amount = PRINCIPAL;
inrate = 0.11;
year = 0;

,/*------------------ COMPUTATION STATEMENTS -------------------*/
/*--------------- COMPUTATION USING While LOOP ----------------*/
while(year <= PERIOD)
{ printf(“%2d %8.2f\n”,year, amount);
value = amount + inrate * amount;
year = year + 1;
amount = value;
}
/*----------------------- while LOOP ENDS ---------------------*/
}
/*------------------------ PROGRAM ENDS -----------------------*/


Fig. 1.5 Program for investment problem


Program

/*------------------- PROGRAM USING FUNCTION ------------------*/

int mul (int a, int b); /*------- DECLARATION ------------*/

/*-------------------- MAIN PROGRAM BEGINS --------------------*/
main ()
{
int a, b, c;

a = 5;
b = 10;
c = mul (a,b);

printf (“multiplication of %d and %d is %d”,a,b,c);
}

/* ---------------- MAIN PROGRAM ENDS
MUL() FUNCTION STARTS -----------------*/

int mul (int x, int y)
int p;

p = x*y;
{
return(p);
}
/* -------------------- MUL () FUNCTION ENDS ------------------*/


Fig.1.7 A Program using a user-defined function

, Program

/*--------------- PROGRAM USING COSINE FUNCTION -------------- */
#include <math.h>
#define PI 3.1416
#define MAX 180

main ( )
{

int angle;
float x,y;

angle = 0;
printf(“ Angle Cos(angle)\n\n”);

while(angle <= MAX)
{
x = (PI/MAX)*angle;
y = cos(x);
printf(“%15d %13.4f\n”, angle, y);
angle = angle + 10;
}
}

Written for

Institution
Course

Document information

Uploaded on
January 20, 2025
Number of pages
217
Written in
2024/2025
Type
Class notes
Professor(s)
Sumit meena
Contains
All classes

Subjects

$8.79
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
divyamali277

Get to know the seller

Seller avatar
divyamali277 Lbs sr sec school
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
1 year
Number of followers
0
Documents
1
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions