Professional Documents
Culture Documents
Elementary Programs in C Part2
Elementary Programs in C Part2
Elementary Programs in C Part2
Due to these things I have thought of giving free discussions on various subjects
of AMIE. Section A & Section B (Electrical only).I intend to teach the subjects on
Saturday and Sundays. Being an AMIE passed candidate I have thought of
helping my fellow brethren with it. I can be contacted on
Michael Sony
H.no 50/A, St.Pedro
Ribander Goa
403006
Tel:09881079529
Email:michaelsonygoa@gmail.com
Michael Sony
How to refer this Tutorial
This Assignments is designed for Computer and Informatics to
take care of C needs of AMIE students. Hence the no prerequisite
for these tutorials.
main()
{
int sum = 50;
float modulus;
The % of 50 by 10 is 0.00
2. #include <stdio.h>
main()
{
int count = 0, loop;
main()
{
int sum, loop, kettle, job;
char whoknows;
sum = 9;
loop = 7;
whoknows = 'A';
printf( "Whoknows = %c, Kettle = %d\n", whoknows, kettle
);
}
4. Sample program illustrating use of scanf() to read integers, characters and floats
#include < stdio.h >
main()
{
int sum;
char letter;
float money;
1. Use a printf statement to print out the value of the integer variable sum
2. Use a printf statement to print out the text string "Welcome", followed by a newline.
5. Use a printf statement to print out the float variable dump using two decimal places
6. Use a scanf statement to read a decimal value from the keyboard, into the integer
variable sum
7. Use a scanf statement to read a float variable into the variable discount_rate
8. Use a scanf statement to read a single character from the keyboard into the variable
operator. Skip leading blanks, tabs and newline characters.
printf("%d", sum);
2. Use a printf statement to print out the text string "Welcome", followed by a newline.
printf("Welcome\n");
printf("%f", discount);
5. Use a printf statement to print out the float variable dump using two decimal places
printf("%.2f", dump);
6. Use a scanf statement to read a decimal value from the keyboard, into the integer
variable sum
scanf("%d", &sum);
7. Use a scanf statement to read a float variable into the variable discount_rate
scanf("%f", &discount_rate);
8. Use a scanf statement to read a single character from the keyboard into the variable
operator. Skip leading blanks, tabs and newline characters.
Michael Sony
H.no 50/A
St.Pedro Ribander
Goa- 403006
Tel:-09881079529