- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 0
- Posts with Upvotes
- 0
- Upvoting Members
- 0
- Downvotes Received
- 2
- Posts with Downvotes
- 2
- Downvoting Members
- 2
7 Posted Topics
#include<stdio.h> #include<conio.h> void main() { int a,b; printf("Enter two numbers"); scanf("%d%d",&a,&b); for(;b>=0;b--)/* ONLY RELATIONAL AND INCREMENT DECREMENT OPERATORS ARE USED HERE*/ { a++; } printf("The sum is : %d",a); }
you can if else ladder that will solve this problem in better way
one of the main problem with this coding is that else part should not contain any conditions if you need to add condition it should be if else why r u complicating much? you can try this coding [CODE]import java.util.Scanner; public class OrderVariable { public static void main (String [] …
if we need to execute the loop only once there is no need of recursion using simply [COLOR="Green"]return;[/COLOR] will help you to get the desired output
one of the reason which i know is you can call the method even without creating the object for the corresponding class to which it belongs..
[QUOTE=JerryRong;1715235]i created a loop and it doesn't run: [CODE] for ( int i = 0; i < 100; i++) { for( int j = 0; j < 100; j++); { int total = i + j; } System.out.println( total ); }[/CODE][/QUOTE] total variable should be declared before the starting of …
i think on getting the value of the "ch" variable you might have given "scanf("%d",ch);" instead of "scanf("%d",&ch);" check once for this
The End.
karthi.k.s