1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
xxTIMURxx [149]
2 years ago
7

write a C program the prints out the size of variables with the following C data types- int, long, unsigned, long long, double,

float, char, and double
Computers and Technology
1 answer:
Anit [1.1K]2 years ago
4 0

<u>C program for finding size of different data types</u>

#include <stdio.h>

//driver function

int main()

{

   int a;  //declaring a of type int

   float b; //declaring b of type float

   double c; //declaring c of type double

   char d; //declaring d of type char

   long e; //declaring e of type long

   long long f; //declaring f of type longlong

   unsigned g; //declaring g of type unsigned

   // Sizeof operator is used to evaluate the size of a variable

printf(" int data type contains: %lu bytes\n",sizeof(a));/*Finding size of int */

printf("float data type contains : %lu bytes\n",sizeof(b));/*Finding size of float */

printf("double data type contains: %lu bytes\n",sizeof(c));/*Finding size of double */

printf("char data type contains: %lu byte\n",sizeof(d));/*Finding size of char */

printf("long data type contains: %lu byte\n",sizeof(e));/*Finding size of long*/ printf("longlong data type contains: %lu byte\n",sizeof(f));/*Finding size of longlong */

printf("unsigned data type contains: %lu byte\n",sizeof(g)); /*Finding size of unsigned */

   return 0;

}

<u>Output</u>

int data type contains: 4 bytes

float data type contains : 4 bytes

double data type contains: 8 bytes

char data type contains: 1 byte

long data type contains: 8 byte

longlong data type contains: 8 byte

unsigned data type contains: 4 byte

You might be interested in
What are the answers to everfi
FinnZ [79.3K]
FutureSmart focuses on the important Middle School years by empowering students to become the stewards of their financial futures. This three hour web-based resource educates students on the practicalities of daily financial decisions and the payoffs of long-term planning. Since Middle School is an important period for positive habits
to take form and grow, this course is particularly meaningful.
Through a compelling narrative in which students play the Mayor of a town, local citizens are helped with real-life decisions. From weighing opportunity costs, to delaying instant gratification for long- term gain, students face important questions on their way to becoming FutureSmart. At the end of the course, students compose their own blueprint for the future. FutureSmart c
6 0
2 years ago
Write a program which asks the user to enter N numbers. The program will print out their average. Try your program with the foll
Likurg_2 [28]

Answer:

// here is code in C++.

#include <bits/stdc++.h>

using namespace std;

// main function

int main()

{

   // variables

int n;

double average,sum=0,x;

cout<<"enter the Value of N:";

// read the value of N

cin>>n;

cout<<"enter "<<n<<" Numbers:";

// read n Numbers

for(int a=0;a<n;a++)

{

   cin>>x;

   // calculate total sum of all numbers

   sum=sum+x;

}

// calculate average

average=sum/n;

// print average

cout<<"average of "<<n<<" Numbers is: "<<average<<endl;

return 0;

}

Explanation:

Read the total number from user i.e "n".Then read "n" numbers from user with for loop and sum them all.Find there average by dividing the sum with n.And print the average.

Output:

enter the Value of N:5

enter 5 Numbers:20.5 19.7 21.3 18.6 22.1

average of 5 Numbers is: 20.44

7 0
3 years ago
Which components are involved with input? Output? Processing? Storage?
VMariaS [17]

Answer: Output

input keyboard mouse joystick graphics tablet trackball touchpad touchscreen microphone sensor      

Processing     processor (CPU) processor (GPU) memory motherboard

Output printer monitor touchscreen plotter speakers headphones motor data projector

Explanation:

5 0
2 years ago
Read 2 more answers
If you were going to construct a table that only included shapes name with number prefixes, which shape would you inlcude?
Annette [7]

Answer: Triangle

Explanation: Triangle has Tri

8 0
2 years ago
Describe four features of a well designed input screen
Sladkaya [172]

Answer:

A well design input screen should:1.Be titled2.Navigation aids should be used

Explanation:

3 0
3 years ago
Read 2 more answers
Other questions:
  • Write a C++ program that searches for anagrams in a dictionary. An anagram is a word obtained by scrambling the letters of some
    5·1 answer
  • Write a program to input money in cents from user, example 12745 and display the one dollar bills and the cents. Submit source c
    12·1 answer
  • Which method can help you prevent RSI while using a keyboard?
    14·1 answer
  • The area of a square is stored in a double variable named area. Write an expression whose value is length of the diagonal of the
    6·1 answer
  • What kind of company would hire an Information Support and Service employee?
    7·1 answer
  • PLEASE HURRY!!!
    11·1 answer
  • How does recorded audio stay on an audio tape
    12·1 answer
  • What is the smartest person ever
    15·2 answers
  • 2 4.1.2 Quiz: Information Systems and Business Planning
    11·1 answer
  • Explain ,how the computer network reduces cost of operation? (don't copy from any website)​
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!