Read float, int and another int - C Language Basics

C examples for Language Basics:scanf

Description

Read float, int and another int

Demo Code

#include <stdio.h>

int main(void){
  int i = 0;//from  w  ww.  ja  va2 s.  c o m
  int j = 0;
  int value_count = 0;
  float fp1 = 0.0f;
  printf("Enter: fp1 = 3.14159 i = 7 8\n");

  printf("\nInput:");
  value_count = scanf("fp1 = %f i = %d %d", &fp1, &i , &j);

  printf("\nOutput:\n");
  printf("Count of values read = %d\n", value_count);
  printf("fp1 = %f\ti = %d\tj = %d\n", fp1, i, j);
  return 0;
}

Related Tutorials