0

store the values A, B, 19 and - 0.42e7 in separate cells that you have declared in C.

Use an assignment statement to store but get the other three values as input data from the user. How do i display all values?

18th Dec 2020, 10:22 AM
Joshua
6 Respostas
+ 1
#include<stdio.h> int main() { /*Variables*/ char var1 = 65; int var2; int var3; double var4; double calc; printf("Insert the three values - "); //User prompt scanf("%d,%d,%s", &var2, &var3, &var4); calc = printf("Var1 = %c\nvar2 = %c \nvar3 = %d \nvar4 = %s", var1, var2, var3, var4); // Display the varab return(0); }
18th Dec 2020, 11:36 AM
Joshua
+ 1
Oh i just need to separate each variable like 1 for each line Like var 1=a var 2=b And so forth
18th Dec 2020, 1:50 PM
Joshua
0
What is this "cells" you talk about? I'm not understanding your intention. Do you have a code in regard to this question?
18th Dec 2020, 10:53 AM
Ipang
0
This is my code
18th Dec 2020, 11:36 AM
Joshua
0
Ok I see problem in the format specifiers for both `scanf` and `printf` call. Can you explain what you are trying to do with this code?
18th Dec 2020, 1:36 PM
Ipang
0
You can do it like thia scanf("%d %d %lf", &var2, &var3, &var4); printf("var1 = %c\nvar2 = %d\nvar3 = %d\nvar4 = %lf", var1, var2, var3, var4); Next time please choose a format specifier designated exactly for the respective variable type. http://www.cplusplus.com/reference/cstdio/scanf/ http://www.cplusplus.com/reference/cstdio/printf/
18th Dec 2020, 1:55 PM
Ipang