Showing posts with label %d. Show all posts
Showing posts with label %d. Show all posts

Simple "printf" command

Wednesday, 1 May 2013

In making C/C++ programs we always encounter these commands: printf and %d. Both of these commands are vital in making programs because both of it are useful especially in printing integers for mathematical purposes. So, I thought of making a simple program to showcase the printf and %d commands.

Furthermore, printf command is used to instruct the computer to perform an action. While, %d is a conversion specifier which means that an integer must be printed out on the screen. In this program, it shows how to use the printf and %d commands. It will simply call the integers declared at the top and there will be no need to get inputs from the user. Check out the codes below.



#include<stdio.h>
#include<conio.h>

main()
{
int var1 = 9, var2 = 10, var3 = 9;
if(var1!=var2)
              printf("\n%d", var1);
             

if(var1!=var3)
              printf("\n\n%d", var1);
              printf("\n%d", var2);
              printf("\n%d", var3);

Related Posts Plugin for WordPress, Blogger...