PDF- basic c programs for beginners -Model Checking C Programs with MSVL - C Programs

Description

! #include int main() { printf("Hello World

- return 0

- ! Welcome to our planet Earth

#include int main() { printf("Hello Aliens

- ! Welcome to our planet Earth
- return 0

Think that you are a scientist and you have invented a Humanoid Robo

You want to introduce your Robo in a public meeting

So feed the basic information into the Robo using C program

Sample Input and output: Enter the Name : Chitti Enter the Creator Name : Dr

Vasegran Enter the Purpose : militaryservice Memory Space : 22

Speed : 1

- 1 My Details : I am the Robot named Chitti

I am created for the purpose of militaryservice

My memory space is around 22Gb and my speed is 1

#include int main () { char a[20],

- float e
- printf("Enter the Name :\n")
- scanf("%s",

printf("Enter the Creator Name :\n")

- scanf("%s",

printf("Enter the Purpose :\n")

- scanf("%s",
- printf("Memory Space :\n")
- scanf("%d",
- printf("Speed :\n")
- scanf("%f",
- printf("My Details :\n")

printf("I am the Robot named %s

- printf("I was created by %s

printf("I am created for the purpose of %s

printf("My memory space is around %dGb and my speed is %

- return 0

NEWSPAPER REPORT In Japan ,there was a very huge Tsunami

Most of them were injured and few were safe

A news reporter arrives to the spot to take the current survey regarding the situation of the people alive ,

- dead and injured

Can you please help him in this noble cause by writing a C program to generate the newspaper report

SAMPLE INPUT AND OUTPUT FORMAT: Enter the number of people dead: 2000 Enter the number of people injured: 3000 Enter the number of people safe: 10000 TSUNAMI REPORT OF JAPAN The number of people 1)Dead:2000 2)Injured:3000 3)Safe:10000 Please help the people who are suffering

#include int main() { int dead,

- injured,

printf("Enter the number of people dead:\n")

- scanf("%d",

printf("Enter the number of people injured:\n")

- scanf("%d",
- &injured)

printf("Enter the number of people safe:\n")

- scanf("%d",

printf("TSUNAMI REPORT OF JAPAN\n")

printf("The number of people\n")

- printf("1)Dead:%d\n",
- printf("2)Injured:%d\n",
- injured)
- printf("3)Safe:%d\n",

printf("Please help the people who are suffering

- return 0

PD sir Mr

Sundar has decided to conduct some team games

He wants to split the students in the class into equal sized teams

In some cases,

there may be some students who are left out from teams and he wanted to use the left out students to assist him in conducting the team games

if there are 50 students in the class and if the class has to be divided into 7 equal sized teams,

- 7 students will be there in each team and 1 student will be left out

? Input Format: Input consists of 2 integers

The first integer corresponds to the number of students in the class and the second integer corresponds to the number of teams

Sample Input and Output: [All text in bold corresponds to input and the rest corresponds to output] Enter the number of students in the class 60 Enter the number of teams 8 The number of students in each team is 7 and the number of students left out is 4 #include int main(){ int dividend,

- divisor

printf("Enter the number of students in the class")

- scanf("%d",÷nd)

printf("Enter the number of teams")

- scanf("%d",&divisor)

printf("The number of students in each team is %d\n and the number of students left out is %d",dividend/divisor,

- dividend%divisor)
- return 0

Alice was bored that day,so she was sitting on the riverbank

Suddenly she notices a talking,

White Rabbit with a pocket watch

- down a rabbit hole

She fell into the hole and found a magical wonderland with dark trees,

- beautiful flowers

She found many ways numbered from 1,2,3,

she was confused which is the right way that will lead her to her home

- standing in one of the tree

The bird said a two digit number( say 23 ) and asked her to find the sum of its digits (2+3=5) and that numbered way will lead her to her home

so pls help Alice in finding the route to her home

Input Format: Input consists of an integer corresponding to the 2-digit number

Refer sample input and output for formatting specifications

[All text in bold corresponds to input and the rest corresponds to output] SAMPLE INPUT OUTPUT 1 : The bird said: 23 Alice must go in path-5 to find her way to home SAMPLE INPUT OUTPUT 2 : The bird said: 99

Alice must go in path-18 to find her way to home

#include int main() { int a,b,c,d

- printf("The bird said:\n")
- scanf("%d",&a)

printf("Alice must go in path-%d to find her way to home”,

- return 0

The college ground is rectangular in shape

they planned to place a thick rope around the ground

They also wanted to cover the entire ground with a thick carpet during rainy season

Can you please help them by writing a C program to find the exact length of the rope and the exact quantity of carper that is needed

Input Format: Input consists of 2 integers

The first integer corresponds to the length of the ground and the second integer corresponds to the breadth of the ground

Sample Input and Output: [All text in bold corresponds to input and the rest corresponds to output] Enter the length of the ground 50 Enter the width of the ground 20 The length of the rope needed is 140m The quantity of carpet needed is 1000sqm #include int main() { int a,b

printf("Enter the length of the ground\n")

- scanf("%d",&a)

printf("Enter the width of the ground\n")

- scanf("%d",&b)

printf("The length of the rope needed is %dm\n",

2*(a+b))

printf("The quantity of carpet needed is %dsqm\n ",

- return 0

The shape of the college ground is Square

For the Independence day Flag Hoisting Function,

it has been decided to place the flag post at the exact center of the ground

Given the coordinates of the left bottom vertex of the square ground and the length of the side,

you need to write a program to determine the coordinates of the centre of the ground

- --- Length of the side is always even]

The third integer corresponds to the length of the square

Sample Input and Output: [All text in bold corresponds to input and the rest corresponds to output] Enter the x-coordinate of the left bottom vertex 4 Enter the y-coordinate of the left bottom vertex O Enter the length of a side 8 The centre of the ground is at (8,4)

- #include int main() { int a,

printf("Enter the x-coordinate of the left bottom vertex\n")

- scanf("%d",

printf("Enter the y-coordinate of the left bottom vertex\n")

- scanf("%d",

printf("Enter the length of a side\n")

- scanf("%d",
- a = c'/ 2 + a
- b = c'/ 2 + b

printf("The centre of the ground is at (%d,%d)\n",

- return 0

The mathematics teacher has recently taught the formula for computing the distance between 2 points to her students

she gave each student a different set of questions

But she found it very difficult to correct all 100 assignments

determine the sides of the triangle AB,

The next 2 integers correspond to the x-coordinate and y-coordinate of vertex B

[All floating pont values are displayed correct to 1 decimal place]

Sample Input and Output: [All text in bold corresponds to input and the rest corresponds to output]

Enter the x-coordinate of vertex A 5 Enter the y-coordinate of vertex A 10 Enter the x-coordinate of vertex B 10 Enter the y-coordinate of vertex B 10 Enter the x-coordinate of vertex C 8 Enter the y-coordinate of vertex C 4 Length of side AB is 5

- 0 Length of side BC is 6
- 3 Length of side AC is 6

#include #include void main() { float distance1,

- distance2,
- distance3
- int x1,
- int d1,

printf("Enter the x-coordinate of vertex A\n")

- scanf("%d",&x1)

printf("Enter the y-coordinate of vertex A\n")

- scanf("%d",&y1)

printf("Enter the x-coordinate of vertex B\n")

- scanf("%d",&x2)

printf("Enter the y-coordinate of vertex B\n")

- scanf("%d",&y2)

printf("Enter the x-coordinate of vertex C\n")

- scanf("%d",&x3)

printf("Enter the y-coordinate of vertex C\n")

- scanf("%d",&y3)
- d1 = x2-x1
- d2 = y2-y1
- d3 = x3-x2
- d4 = y3-y2
- d5 = x3-x1
- d6 = y3-y1
- distance1=sqrt(d1*d1+d2*d2)
- distance2=sqrt(d3*d3+d4*d4)
- distance3=sqrt(d5*d5+d6*d6)

printf("Length of side AB is %

- distance1)

printf("Length of side BC is %

- distance2)

printf("Length of side AC is %

- distance3)

Her 7th class students like her very much and they wanted to give her a grand farewell at school

The school HeadMistress is a very strict person and she didn't give permission for them to conduct the farewell in the school premises

Emily Mam's last class was on Equation for a straight line

She said that a straight line can be represented by the equation y=mx+c and you know how to find the xintercept and y-intercept of the line and my house number is the sum of the x-intercept and y-intercept of the line

? Given the values of m and c'of the line equation y=mx+c,

write a C program to find the sum of x-intercept and y-intercept

The first integer corresponds to m and the second integer corresponds to c

[Assume that the inputs are such that the intercept values are always integers] Sample Input and Output: [All text in bold corresponds to input and the rest corresponds to output] Enter the value of m 5 Enter the value of c'10 The line equation is y=5x+10 The x intercept is

- -2 The y intercept is 10 The house number is 8 #include int main() { int a,b

printf("Enter the value of m\n")

- scanf("%d",&a)

printf("Enter the value of c\n")

- scanf("%d",&b)

printf("The line equation is y=%dx+%d\n",a,b)

printf("The x intercept is %d\n",-b/a)

printf("The y intercept is %d\n",b)

printf("The house number is %d\n",b+(-b/a))

- return 0
- } Ajay,

Binoy and Chandru live in the same locality

A new student Dinesh joins their class and he wanted to be friends with them

Binoy wanted to test Dinesh's mathematical skills

Binoy told Dinesh that his house is at the midpoint of the line joining Ajay's house and Chandru's house

Dinesh was puzzled

? Given the coordinates of the 2 end points of a line (x1,y1) and (x2,y2),

write a C program to find the midpoint of the line

The first integer corresponds to x1

[All floating point values are displayed correct to 1 decimal place] Sample Input and Output: [All text in bold corresponds to input and the rest corresponds to output] Enter x1 2 Enter y1 4 Enter x2 10 Enter y2 15 Binoy's house is located at (6

#include #include int main() { int x1,

- float a,b
- int c=2
- printf("Enter x1\n")
- scanf("%d",&x1)
- printf("Enter y1\n")
- scanf("%d",&y1)
- printf("Enter x2\n")
- scanf("%d",&x2)
- printf("Enter y2\n")
- scanf("%d",&y2)
- a=x2+x1
- b=y2+y1

printf("Binoy’s house is located at (%

- a/c,b/c)
- return 0

Meanwhile,

Binoy has moved to a new house in the same locality

Now the houses of Ajay,

Dinesh also has moved to a house in the same locality

- he was puzzled

Can you please help Ajay out

(x2,y2) and (x3,y3)} of a triangle,

write a C program to determine the point which is equidistant from all the 3 vertices

The fifth and sixth integers correspond to x3 and y3 respectively

[All floating point values are displayed correct to 1 decimal place] Sample Input and Output: [All text in bold corresponds to input and the rest corresponds to output] Enter x1 2 Enter y1 4 Enter x2 10 Enter y2 15 Enter x3 5 Enter y3 8 Dinesh’s house is located at (5

- 0)\ #include int main() { int x1,x2,x3,y1,y2,y3
- printf(“Enter x1”)
- scanf(“%d”,&x1)
- printf(“\nEnter y1”)
- scanf(“%d”,&y1)
- printf(“\nEnter x2”)
- scanf(“%d”,&x2)
- printf(“\nEnter y2”)
- scanf(“%d”,&y2)
- printf(“\nEnter x3”)
- scanf(“%d”,&x3)
- printf(“\nEnter y3”)
- scanf(“%d”,&y3)

printf(“\nDinesh’s house is located at (%

- 1f)”,(x1+x2+x3)/3
- 0,(y1+y2+y3)/3
- return 0

a newspaper agency sells x copies of a certain newspaper for Rs

- a per copy

The cost to the agency of each newspaper is Rs

- delivery and so on of Rs
- 100 per Sunday

- a and b

- a and b

a is the cost per copy and b is the cost the agency spends per copy

Sample Input and Output: [All text in bold corresponds to input and the rest corresponds to output] Enter the number of copies sold 1000 Enter the cost of 1 copy of the newspaper 2 Enter the cost spent by the agency on 1 copy of the newspaper 1 The profit obtained is Rs

- 900 #include int main() { int a,b,c,x

printf("Enter the number of copies sold")

- scanf("%d",&a)

printf("\nEnter the cost of 1 copy of the newspaper")

- scanf("%d",&b)

printf("\nEnter the cost spent by the agency on 1 copy of the newspaper")

- scanf("%d",&c)
- x=(a*b)-(a*c)-100

printf("\nThe profit obtained is Rs

- return 0

A grocer has a sale of Rs

- s4 and Rs
- s5 for 5 consecutive months

? Write a C program to compute the sale in the 6th month

s4 and s5

The float input corresponds to x

Sample Input and Output: [All text in bold corresponds to input and the rest corresponds to output] Enter sale in first month 6435 Enter sale in second month

- 6927 Enter sale in third month 6855 Enter sale in fourth month 7230 Enter sale in fifth month 6562 Enter the average sales in 6 months 6500 The sale in the sixth month is Rs
- 00 #include int main() { float avg,m1,m2,m3,m4,m5

printf("Enter sale in first month")

- scanf("%f",&m1)

printf("\nEnter sale in second month")

- scanf("%f",&m2)

printf("\nEnter sale in third month")

- scanf("%f",&m3)

printf("\nEnter sale in fourth month")

- scanf("%f",&m4)

printf("\nEnter sale in fifth month")

- scanf("%f",&m5)

printf("\nEnter the average sales in 6 months")

- scanf("%f",&avg)

printf("\nThe sale in the sixth month is Rs

- 2f",(6*avg-(m1+m2+m3+m4+m5)))
- return 0

Conditional statements 1

Sample Input 1: 3 Sample Output 1: 3 is an odd number Sample Input 2: 44 Sample Output 2: 44 is an even number #include int main() { int n

- scanf("%d",&n)

if(n%2==0) printf("%d is an even number",n)

else printf("%d is an odd number",n)

- return 0

Write a program to find whether a given number is divisible by both 7 and 3

Output Format: Output consists of a single line

Sample Input 1: 21 Sample Output 1 : 21 is divisible by both 7 and 3 Sample Input 2: 18 Sample Output 2: 18 is not divisible by both 7 and 3 #include int main() { int n

- scanf("%d",&n)

if(n%7==0 && n%3==0) printf("%d is divisible by both 7 and 3",n)

else printf("%d is not divisible by both 7 and 3",n)

- return 0

divisible by 2 or 3 #include int main() { int n

- scanf("%d",&n)

if(n%2==0 || n%3==0) printf("yes")

- else printf("no")
- return 0

maximum of 2 #include int main() { int a,b

- scanf("%d%d",&a,&b)

if(a>b) printf("%d is the maximum number",a)

else printf("%d is the maximum number",b)

- return 0

maximum of 3 #include int main() { int a,b,c

- scanf("%d%d%d",&a,&b,&c)

if(a>b&&a>c) printf("%d is the maximum number",a)

else if(b>a&& b>c) printf("%d is the maximum number",b)

else printf("%d is the maximum number",c)

- return 0
- leap year
- #include int main() { int n
- scanf("%d",&n)

if(n%400==0) printf("%d is a leap year",n)

else if (n%100==0) printf("%d is not a leap year",n)

else if (n%4==0) printf("%d is a leap year",n)

else printf("%d is not a leap year",n)

- return 0

calculate grade #include int main() { int x,y,z,w

- scanf("%d%d%d",&x,&y,&z)
- w=(x+y+z)/3

if(w>=90) printf("The grade is A")

else if(w=80) printf("The grade is B")

else if (w=70) printf("The grade is C")

else if(w=60) printf("The grade is D")

else if (w=50) printf("The grade is E")

- else printf("The grade is F")
- return 0

character upper or lower #include #include int main() { char s

- scanf("%c",&s)

if(isalpha(s)) { if(islower(s)) printf("%c is lowercase letter",s)

else printf("%c is uppercase letter",s)

} else printf("%c is neither an uppercase or lowercase letter",s)

- return 0

in or out #include int main() { int n,s

printf("Enter the number of problems given")

- scanf("%d",&n)

printf("\nEnter the number of problems solved")

- scanf("%d",&s)
- if(s>n/2) printf("\nIN")
- else printf("\nOUT")
- return 0

new or old #include int main() { int n,m

printf("Enter the year of establishment of college 1")

- scanf("%d",&n)

printf("\nEnter the year of establishment of college 2")

- scanf("%d",&m)

if(n=sp || n>= tp) { if(fpb) printf("\nCollege 1 is better")

else printf("\nCollege 2 is better")

- return 0
- y2k problem

#include int main() { int b,c,x

- printf("Enter Year of Birth")
- scanf("%d",&b)

printf("\nEnter Current year")

- scanf("%d",&c)
- if(c>b) { x=c-b
- printf("\nYour age is %d",x)
- } else { c+=100
- printf("\nYour age is %d",x)
- } return 0
- #include int main() { int m
- scanf("%d",&m)

switch(m) { case 1:printf("January\n")

- case 2:printf("February\n")
- case 3:printf("March\n")
- case 4:printf("April\n")
- case 5:printf("May\n")
- case 6:printf("June\n")
- case 7:printf("July\n")
- case 8:printf("August\n")
- case 9:printf("September\n")
- case 10:printf("October\n")
- case 11:printf("November\n")
- case 12:printf("December\n")

default :printf("Invalid month\n")

- } return 0

basic calculator #include int main() { int a,b

- scanf("%d\n",&a)
- scanf("%c\n",&c)
- scanf("%d",&b)

switch(c) { case '+' :printf("The sum is %d",a+b)

case '-' :printf("The difference is %d",a-b)

case '*' :printf("The product is %d",a*b)

case '/' :printf("The quotient is %d",a/b)

case '%':printf("The remainder is %d",a%b)

default : printf("Invalid Input")

- } return 0

fees calculator #include int main() { char d

- int p,f,a,af,tot
- scanf("%c",&d)

scanf("%d%d%d%d",&p,&f,&a,&af)

switch(d) { case 'A': tot=(p*f)+(a*af)

printf("The fee to be paid is Rs

- %d",tot)

case 'B': tot=((p*f)+(a*af))+5000

printf("The fee to be paid is Rs

- %d",tot)

case 'C': tot=((p*f)+(a*af))+1500

printf("The fee to be paid is Rs

- %d",tot)

case 'D': tot=((p*f)+(a*af))+6500

printf("The fee to be paid is Rs

- %d",tot)
- return 0

hotel tariff #include int main() { int m

- float r,d,tar
- scanf("%d",&m)
- scanf("%f%f",&r,&d)
- switch(m) { case 1: tar=r*d
- printf("Hotel Tariff: Rs

2f\n",tar)

- case 2: tar=r*d
- printf("Hotel Tariff: Rs

2f\n",tar)

- case 3: tar=r*d
- printf("Hotel Tariff: Rs

2f\n",tar)

case 4: tar=(r*d)+2*((r*d)/10)

- printf("Hotel Tariff: Rs

2f\n",tar)

case 5: tar=(r*d)+2*((r*d)/10)

- printf("Hotel Tariff: Rs

2f\n",tar)

- case 6:tar=(r*d)+2*((r*d)/10)
- printf("Hotel Tariff: Rs

2f\n",tar)

- case 7:tar=r*d
- printf("Hotel Tariff: Rs

2f\n",tar)

- case 8:tar=r*d
- printf("Hotel Tariff: Rs

2f\n",tar)

- case 9:tar=r*d
- printf("Hotel Tariff: Rs

2f\n",tar)

- case 10:tar=r*d
- printf("Hotel Tariff: Rs

2f\n",tar)

case 11: tar=(r*d)+2*((r*d)/10)

- printf("Hotel Tariff: Rs

2f\n",tar)

case 12: tar=(r*d)+2*((r*d)/10)

- printf("Hotel Tariff: Rs

2f\n",tar)

default :printf("Invalid Input\n")

- } return 0

Conditional Statements Looping

print1 #include int main() { int a,b,i

printf("Enter the value of a")

- scanf("%d",&a)

printf("\nEnter the value of b")

- scanf("%d",&b)
- for(i=a
- i--) printf("\n%d",i)
- return 0
- print 3

#include int main() { int a,b,i

printf("Enter the value of a")

- scanf("%d",&a)

printf("\nEnter the value of b")

- scanf("%d",&b)
- if(a>b) { for(i=a
- printf("\n%d",i)
- } else { for(i=a

centercomp biology projects for class 12 pdf Biology Projects for Class 12 CBSE High School Students The Biology Project, an interactive online resource for learning biology developed at The University of Arizona The Biology Project is fun, richly illustrated, and tested on 1000s of students It

Library management system is a project which aims in developing a computerized system to maintain all the daily work of library This project has many features Nov 15, 2011 You can build library management system on your own Do not submit project with

PDF C Language Questions and Answers Techtud techtud C 20Language 20100 20Questions 20Answers pdf PDF C Programs with Solutions skiet downloads cprogrammingquestion pdf PDF C Programming Question And Answer The Right

PDF Till We Have Faces Cs Lewisapi wl2 stage ovdal dk till we have faces cs lewis pdf PDF C S Lewis At The Bbc Messages Of Hope In The Darkness Of Warcluster rifiniti c s lewis at the bbc messages of hope in the darkness

logosul files wordpress 2014 03 cs lewis creştin înzestrat cu o minte excepţional de ascuţită şi de logică şi cu un stil lucid şi înviorător, C S Lewis a fost fără egal The Problem of Pain (Problema durerii), The Screwtape Letters (Scrisorile lui Sfredelin sau Sfaturile unui

PDF C# Programlama Dili ilkerunal wp content uploads 2012 01 Bölüm 2 pdf PDF Programlamanın Temelleri baskent edu tr ~tkaracay etudio ders prg csharp ch01 pdf PDF C Sharp Programlama Dili Metotlarfenfak ege edu tr 9 C Sharp Programlama Dili Metotlar

ilkerunal wp content uploads 2012 01 Bölüm 2 pdf Programlama dillerinde tek başlarına herhangi bir anlamı olmayan ancak programın işleyişine katkıda bulunan karakter ya da karakter topluluklarına operatör denir Örneğin a+b ifadesinde + işareti bir operatördür Operatörlerin etki ettikleri sabit ya da değişkenlere ise operand denir

mooict wp content uploads 2016 02 Creating a Flappy Bird game in Visual Studio Using C# First Create a new Windows Form Application in Visual Studio Name it FlappyBird and Click OK We need to add the necessary elements to the windows form