{"id":25,"date":"2016-10-09T05:43:47","date_gmt":"2016-10-09T05:43:47","guid":{"rendered":"http:\/\/54.169.157.34\/blog\/?p=25"},"modified":"2025-08-07T09:26:32","modified_gmt":"2025-08-07T09:26:32","slug":"programs-on-if-statement","status":"publish","type":"post","link":"https:\/\/codeinsightacademy.com\/blog\/c-programming\/programs-on-if-statement\/","title":{"rendered":"Programs on If Statement"},"content":{"rendered":"<p><strong>Basic WAP (Write A Program) Questions<\/strong><\/p>\n<ol>\n<li><strong>Check if a number is even or odd<\/strong><\/li>\n<\/ol>\n<pre><code>Input:\nEnter a number: 5\nOutput:\nNumber 5 is odd\n<\/code><\/pre>\n<ol start=\"2\">\n<li><strong>Check if the last digits of two numbers are the same<\/strong><\/li>\n<\/ol>\n<pre><code>Input:\nEnter number 1: 55\nEnter number 2: 45\nOutput:\nLast digits of 55 and 45 are same\n<\/code><\/pre>\n<ol start=\"3\">\n<li><strong>Check if a triangle can be formed from 3 angles<\/strong><\/li>\n<\/ol>\n<pre><code>Input:\nEnter value for angle a: 50\nEnter value for angle b: 60\nEnter value for angle c: 70\nOutput:\nTriangle can be formed\n<\/code><\/pre>\n<ol start=\"4\">\n<li><strong>Check if a triangle is equilateral<\/strong><\/li>\n<\/ol>\n<pre><code>Input:\nEnter value for angle a: 60\nEnter value for angle b: 60\nEnter value for angle c: 60\nOutput:\nTriangle is equilateral triangle\n<\/code><\/pre>\n<ol start=\"5\">\n<li><strong>Check if student is passed based on marks of 5 subjects<\/strong><\/li>\n<\/ol>\n<pre><code>Input:\nEnter marks for maths: 50\nEnter marks for science: 50\nEnter marks for history: 50\nEnter marks for english: 50\nEnter marks for marathi: 50\nOutput:\nTotal Marks: 250\nPercentage: 50%\nStudent is passed\n<\/code><\/pre>\n<ol start=\"6\">\n<li><strong>Find the greatest of two numbers<\/strong><\/li>\n<\/ol>\n<pre><code>Input:\nEnter number 1: 50\nEnter number 2: 60\nOutput:\n60 is greater than 50\n<\/code><\/pre>\n<ol start=\"7\">\n<li><strong>Find the greatest of three numbers<\/strong><\/li>\n<\/ol>\n<pre><code>Input:\nEnter number 1: 50\nEnter number 2: 60\nEnter number 3: 70\nOutput:\n70 is greater than 50 and 60\n<\/code><\/pre>\n<ol start=\"8\">\n<li><strong>Check if the sum of cube of digits equals the number (Armstrong number)<\/strong><\/li>\n<\/ol>\n<pre><code>Input:\nEnter a 3 digit number: 153\nOutput:\nSuccess: Sum of cube of 153 is 153\n<\/code><\/pre>\n<ol start=\"9\">\n<li><strong>Check if last digits of three numbers are the same<\/strong><\/li>\n<\/ol>\n<pre><code>Input:\nEnter number 1: 50\nEnter number 2: 60\nEnter number 3: 70\nOutput:\nLast digits of 50, 60 and 70 are same\n<\/code><\/pre>\n<ol start=\"10\">\n<li><strong>Check if a number is a palindrome<\/strong><\/li>\n<\/ol>\n<pre><code>Input:\nEnter a number: 121\nOutput:\n121 is palindrome number\n<\/code><\/pre>\n<ol start=\"11\">\n<li><strong>Print total, percentage and result (pass\/fail) from 5 subject marks<\/strong><\/li>\n<\/ol>\n<pre><code>Input:\nEnter marks for maths: 50\nEnter marks for science: 50\nEnter marks for history: 50\nEnter marks for english: 50\nEnter marks for marathi: 50\nOutput:\nTotal Marks: 250\nPercentage: 50%\nStudent is passed\n<\/code><\/pre>\n<ol start=\"12\">\n<li><strong>Check type of triangle based on angles<\/strong><\/li>\n<\/ol>\n<pre><code>Input:\nEnter value for angle a: 45\nEnter value for angle b: 45\nEnter value for angle c: 90\nOutput:\nTriangle can be formed\nThe triangle is right angled triangle\n<\/code><\/pre>\n<ol start=\"13\">\n<li><strong>Check marriage eligibility based on age and gender<\/strong><\/li>\n<\/ol>\n<pre><code>Input:\nEnter gender M or F: M\nEnter your age: 30\nOutput:\n30 ka ho gaya ab to shadi kar le\n<\/code><\/pre>\n<ol start=\"14\">\n<li><strong>Check if a year is a leap year<\/strong><\/li>\n<\/ol>\n<pre><code>Input:\nEnter year: 2004\nOutput:\nYear 2004 is a leap year\n<\/code><\/pre>\n<ol start=\"15\">\n<li><strong>Calculate commission based on salary<\/strong><\/li>\n<\/ol>\n<pre><code>Salary\t\tCommission\n&lt;10000\t\t10%\n10000-20000\t12%\n&gt;20000\t\t15%\n\nInput:\nEnter Salary: 10000\nOutput:\nYour commission is 1000 Rupees\n<\/code><\/pre>\n<ol start=\"16\">\n<li><strong>Print division based on percentage<\/strong><\/li>\n<\/ol>\n<pre><code>Percentage\tDivision\n&gt;=75\t\t1st class with distinction\n60-75\t\t1st class\n50-60\t\t2nd class\n40-50\t\t3rd class\n&lt;40\t\tFail\n\nInput:\nEnter marks for maths: 75\nEnter marks for science: 75\nEnter marks for history: 75\nEnter marks for english: 75\nEnter marks for marathi: 75\nOutput:\nTotal Marks: 375\nPercentage: 75%\nStudent passed with 1st class Distinction\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Basic WAP (Write A Program) Questions Check if a number is even or odd Input: Enter a number: 5 Output: Number 5 is odd Check if the last digits of two numbers are the same Input: Enter number 1: 55 Enter number 2: 45 Output: Last digits of 55 and 45 are same Check if [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1,3,18,4,9],"tags":[],"_links":{"self":[{"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/posts\/25"}],"collection":[{"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/comments?post=25"}],"version-history":[{"count":11,"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/posts\/25\/revisions"}],"predecessor-version":[{"id":2855,"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/posts\/25\/revisions\/2855"}],"wp:attachment":[{"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/media?parent=25"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/categories?post=25"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/tags?post=25"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}